Skip to content

Commit e0052e7

Browse files
victorgomesV8 LUCI CQ
authored andcommitted
[maglev][arm64] Ensure we zero-extend in Int32Multiply
Fixed: 466786677 Change-Id: Ie75222393743a8beeb99f9382dc6d345b8f62604 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7241729 Auto-Submit: Victor Gomes <[email protected]> Commit-Queue: Darius Mercadier <[email protected]> Reviewed-by: Darius Mercadier <[email protected]> Commit-Queue: Victor Gomes <[email protected]> Cr-Commit-Position: refs/heads/main@{#104206}
1 parent cb8d68d commit e0052e7

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

src/maglev/arm64/maglev-ir-arm64.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void Int32Multiply::GenerateCode(MaglevAssembler* masm,
323323
__ Smull(out, left, right);
324324

325325
// Making sure that the 32-bit output is zero-extended.
326-
__ Move(out.W(), out.W());
326+
__ Mov(out.W(), out.W());
327327
}
328328

329329
void Int32MultiplyOverflownBits::SetValueLocationConstraints() {
@@ -468,7 +468,7 @@ void Int32MultiplyWithOverflow::GenerateCode(MaglevAssembler* masm,
468468

469469
// Making sure that the 32-bit output is zero-extended (and moving it to the
470470
// right register if {out_alias_input} is true).
471-
__ Move(out, res.W());
471+
__ Mov(out, res.W());
472472
}
473473

474474
void Int32DivideWithOverflow::SetValueLocationConstraints() {
@@ -536,7 +536,7 @@ void Int32DivideWithOverflow::GenerateCode(MaglevAssembler* masm,
536536
__ CompareAndBranch(temp, Immediate(0), ne,
537537
__ GetDeoptLabel(this, DeoptimizeReason::kNotInt32));
538538

539-
__ Move(out, res);
539+
__ Mov(out, res);
540540
}
541541

542542
void Int32ModulusWithOverflow::SetValueLocationConstraints() {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2025 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax
6+
7+
function trigger(cond) {
8+
let o = {};
9+
let mul = (cond ? 1 : 0x80000000) | 0;
10+
print(mul);
11+
let idx = (mul * 2) | 0;
12+
print(idx);
13+
o[0] = 1.1;
14+
if (cond) o[1] = 2.2;
15+
return o[idx];
16+
}
17+
18+
%PrepareFunctionForOptimization(trigger);
19+
trigger(true);
20+
trigger(false);
21+
%OptimizeMaglevOnNextCall(trigger);
22+
trigger(false);

0 commit comments

Comments
 (0)