Skip to content

Commit c4be24e

Browse files
ngzhianCommit Bot
authored andcommitted
[wasm-simd][liftoff][arm][arm64] Implement all_true
Implement all_true for arm and arm64. Instruction sequence is the same as TurboFan. Bug: v8:9909 Change-Id: Ibe57c6ae6f700dfe5bd23a91a243778b6481c5a0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2222606 Reviewed-by: Clemens Backes <[email protected]> Commit-Queue: Zhi An Ng <[email protected]> Cr-Commit-Position: refs/heads/master@{#68089}
1 parent b972069 commit c4be24e

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

src/wasm/baseline/arm/liftoff-assembler-arm.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,7 +2564,13 @@ void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst,
25642564

25652565
void LiftoffAssembler::emit_v32x4_alltrue(LiftoffRegister dst,
25662566
LiftoffRegister src) {
2567-
bailout(kSimd, "v32x4_alltrue");
2567+
UseScratchRegisterScope temps(this);
2568+
DwVfpRegister scratch = temps.AcquireD();
2569+
vpmin(NeonU32, scratch, src.low_fp(), src.high_fp());
2570+
vpmin(NeonU32, scratch, scratch, scratch);
2571+
ExtractLane(dst.gp(), scratch, NeonS32, 0);
2572+
cmp(dst.gp(), Operand(0));
2573+
mov(dst.gp(), Operand(1), LeaveCC, ne);
25682574
}
25692575

25702576
void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs,
@@ -2666,7 +2672,14 @@ void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst,
26662672

26672673
void LiftoffAssembler::emit_v16x8_alltrue(LiftoffRegister dst,
26682674
LiftoffRegister src) {
2669-
bailout(kSimd, "v16x8_alltrue");
2675+
UseScratchRegisterScope temps(this);
2676+
DwVfpRegister scratch = temps.AcquireD();
2677+
vpmin(NeonU16, scratch, src.low_fp(), src.high_fp());
2678+
vpmin(NeonU16, scratch, scratch, scratch);
2679+
vpmin(NeonU16, scratch, scratch, scratch);
2680+
ExtractLane(dst.gp(), scratch, NeonS16, 0);
2681+
cmp(dst.gp(), Operand(0));
2682+
mov(dst.gp(), Operand(1), LeaveCC, ne);
26702683
}
26712684

26722685
void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs,
@@ -2840,7 +2853,15 @@ void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst,
28402853

28412854
void LiftoffAssembler::emit_v8x16_alltrue(LiftoffRegister dst,
28422855
LiftoffRegister src) {
2843-
bailout(kSimd, "v8x16_alltrue");
2856+
UseScratchRegisterScope temps(this);
2857+
DwVfpRegister scratch = temps.AcquireD();
2858+
vpmin(NeonU8, scratch, src.low_fp(), src.high_fp());
2859+
vpmin(NeonU8, scratch, scratch, scratch);
2860+
vpmin(NeonU8, scratch, scratch, scratch);
2861+
vpmin(NeonU8, scratch, scratch, scratch);
2862+
ExtractLane(dst.gp(), scratch, NeonS8, 0);
2863+
cmp(dst.gp(), Operand(0));
2864+
mov(dst.gp(), Operand(1), LeaveCC, ne);
28442865
}
28452866

28462867
void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs,

src/wasm/baseline/arm64/liftoff-assembler-arm64.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ inline void EmitAnyTrue(LiftoffAssembler* assm, LiftoffRegister dst,
164164
assm->Cset(dst.gp().W(), ne);
165165
}
166166

167+
inline void EmitAllTrue(LiftoffAssembler* assm, LiftoffRegister dst,
168+
LiftoffRegister src, VectorFormat format) {
169+
UseScratchRegisterScope scope(assm);
170+
VRegister temp = scope.AcquireV(ScalarFormatFromFormat(format));
171+
assm->Uminv(temp, VRegister::Create(src.fp().code(), format));
172+
assm->Umov(dst.gp().W(), temp, 0);
173+
assm->Cmp(dst.gp().W(), 0);
174+
assm->Cset(dst.gp().W(), ne);
175+
}
176+
167177
} // namespace liftoff
168178

169179
int LiftoffAssembler::PrepareStackFrame() {
@@ -1500,7 +1510,7 @@ void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst,
15001510

15011511
void LiftoffAssembler::emit_v32x4_alltrue(LiftoffRegister dst,
15021512
LiftoffRegister src) {
1503-
bailout(kSimd, "v32x4_alltrue");
1513+
liftoff::EmitAllTrue(this, dst, src, kFormat4S);
15041514
}
15051515

15061516
void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1621,7 +1631,7 @@ void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst,
16211631

16221632
void LiftoffAssembler::emit_v16x8_alltrue(LiftoffRegister dst,
16231633
LiftoffRegister src) {
1624-
bailout(kSimd, "v16x8_alltrue");
1634+
liftoff::EmitAllTrue(this, dst, src, kFormat8H);
16251635
}
16261636

16271637
void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1766,7 +1776,7 @@ void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst,
17661776

17671777
void LiftoffAssembler::emit_v8x16_alltrue(LiftoffRegister dst,
17681778
LiftoffRegister src) {
1769-
bailout(kSimd, "v8x16_alltrue");
1779+
liftoff::EmitAllTrue(this, dst, src, kFormat16B);
17701780
}
17711781

17721782
void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs,

0 commit comments

Comments
 (0)