Commit 91322bbe authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][liftoff][arm64][arm] Implement anytrue

Implementation for for arm and arm64. For arm64, differ from TurboFan
implementation slightly, we don't need to the lane formats to match up,
V4S will work for all the anytrues, this makes the code slightly simpler
(no need to take the vector format as argument).

Bug: v8:9909
Change-Id: I2f40b56e816200f0f29ca151a8d6652e973350bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2216933Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68076}
parent 15f90b0a
...@@ -381,6 +381,17 @@ inline void EmitSimdShiftImmediate(LiftoffAssembler* assm, LiftoffRegister dst, ...@@ -381,6 +381,17 @@ inline void EmitSimdShiftImmediate(LiftoffAssembler* assm, LiftoffRegister dst,
} }
} }
inline void EmitAnyTrue(LiftoffAssembler* assm, LiftoffRegister dst,
LiftoffRegister src) {
UseScratchRegisterScope temps(assm);
DwVfpRegister scratch = temps.AcquireD();
assm->vpmax(NeonU32, scratch, src.low_fp(), src.high_fp());
assm->vpmax(NeonU32, scratch, scratch, scratch);
assm->ExtractLane(dst.gp(), scratch, NeonS32, 0);
assm->cmp(dst.gp(), Operand(0));
assm->mov(dst.gp(), Operand(1), LeaveCC, ne);
}
} // namespace liftoff } // namespace liftoff
int LiftoffAssembler::PrepareStackFrame() { int LiftoffAssembler::PrepareStackFrame() {
...@@ -2548,7 +2559,7 @@ void LiftoffAssembler::emit_i32x4_neg(LiftoffRegister dst, ...@@ -2548,7 +2559,7 @@ void LiftoffAssembler::emit_i32x4_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v32x4_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs,
...@@ -2645,7 +2656,7 @@ void LiftoffAssembler::emit_i16x8_neg(LiftoffRegister dst, ...@@ -2645,7 +2656,7 @@ void LiftoffAssembler::emit_i16x8_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v16x8_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs,
...@@ -2814,7 +2825,7 @@ void LiftoffAssembler::emit_i8x16_neg(LiftoffRegister dst, ...@@ -2814,7 +2825,7 @@ void LiftoffAssembler::emit_i8x16_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v8x16_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs,
......
...@@ -153,6 +153,17 @@ inline void EmitSimdShiftRightImmediate(LiftoffAssembler* assm, VRegister dst, ...@@ -153,6 +153,17 @@ inline void EmitSimdShiftRightImmediate(LiftoffAssembler* assm, VRegister dst,
} }
} }
inline void EmitAnyTrue(LiftoffAssembler* assm, LiftoffRegister dst,
LiftoffRegister src) {
// AnyTrue does not depend on the number of lanes, so we can use V4S for all.
UseScratchRegisterScope scope(assm);
VRegister temp = scope.AcquireV(kFormatS);
assm->Umaxv(temp, src.fp().V4S());
assm->Umov(dst.gp().W(), temp, 0);
assm->Cmp(dst.gp().W(), 0);
assm->Cset(dst.gp().W(), ne);
}
} // namespace liftoff } // namespace liftoff
int LiftoffAssembler::PrepareStackFrame() { int LiftoffAssembler::PrepareStackFrame() {
...@@ -1484,7 +1495,7 @@ void LiftoffAssembler::emit_i32x4_neg(LiftoffRegister dst, ...@@ -1484,7 +1495,7 @@ void LiftoffAssembler::emit_i32x4_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v32x4_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v32x4_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i32x4_shl(LiftoffRegister dst, LiftoffRegister lhs,
...@@ -1600,7 +1611,7 @@ void LiftoffAssembler::emit_i16x8_neg(LiftoffRegister dst, ...@@ -1600,7 +1611,7 @@ void LiftoffAssembler::emit_i16x8_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v16x8_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v16x8_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i16x8_shl(LiftoffRegister dst, LiftoffRegister lhs,
...@@ -1740,7 +1751,7 @@ void LiftoffAssembler::emit_i8x16_neg(LiftoffRegister dst, ...@@ -1740,7 +1751,7 @@ void LiftoffAssembler::emit_i8x16_neg(LiftoffRegister dst,
void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst, void LiftoffAssembler::emit_v8x16_anytrue(LiftoffRegister dst,
LiftoffRegister src) { LiftoffRegister src) {
bailout(kSimd, "v8x16_anytrue"); liftoff::EmitAnyTrue(this, dst, src);
} }
void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs, void LiftoffAssembler::emit_i8x16_shl(LiftoffRegister dst, LiftoffRegister lhs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment