diff --git a/runtime/tests/vm/dart/regress_46797_test.dart b/runtime/tests/vm/dart/regress_46797_test.dart new file mode 100644 index 00000000000..ceb5f0af734 --- /dev/null +++ b/runtime/tests/vm/dart/regress_46797_test.dart @@ -0,0 +1,21 @@ +// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// VMOptions=--optimization-counter-threshold=100 + +int var74 = -43; + +@pragma("vm:never-inline") +foo(int var74) { + if (var74 >>> 0xC == 675872701) { + print("side-effect"); + } +} + +main() { + for (var i = 0; i < 200; i++) { + foo(43); + } + foo(-43); +} diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc index 9484c2606a8..0262af5b6d0 100644 --- a/runtime/vm/compiler/backend/il_arm64.cc +++ b/runtime/vm/compiler/backend/il_arm64.cc @@ -3541,8 +3541,8 @@ void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { const intptr_t kCountLimit = 0x3F; intptr_t value = Smi::Cast(constant).Value(); ASSERT((value >= 0) && (value <= kCountLimit)); - __ SmiUntag(left); - __ LsrImmediate(result, left, value); + __ SmiUntag(result, left); + __ LsrImmediate(result, result, value); if (deopt != nullptr) { __ SmiTagAndBranchIfOverflow(result, deopt); } else {