Skip to content

Commit 3a8feab

Browse files
ngzhianCommit Bot
authored andcommitted
[wasm-simd][liftoff][arm][arm64] Implement eq and ne
Bug: v8:9909 Change-Id: I67f7ace62b6c257f4f3ad76fb22eff99e4988e2d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2158918 Commit-Queue: Zhi An Ng <zhin@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#67318}
1 parent 3506bff commit 3a8feab

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

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

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,27 @@ inline void S128NarrowOp(LiftoffAssembler* assm, NeonDataType dt,
219219
}
220220
}
221221

222+
inline void F64x2CompareEquality(LiftoffAssembler* assm, LiftoffRegister dst,
223+
LiftoffRegister lhs, LiftoffRegister rhs,
224+
Condition cond) {
225+
QwNeonRegister dest = liftoff::GetSimd128Register(dst);
226+
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
227+
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
228+
UseScratchRegisterScope temps(assm);
229+
Register scratch = temps.Acquire();
230+
231+
assm->mov(scratch, Operand(0));
232+
assm->VFPCompareAndSetFlags(left.low(), right.low());
233+
234+
assm->mov(scratch, Operand(-1), LeaveCC, cond);
235+
assm->vmov(dest.low(), scratch, scratch);
236+
237+
assm->mov(scratch, Operand(0));
238+
assm->VFPCompareAndSetFlags(left.high(), right.high());
239+
assm->mov(scratch, Operand(-1), LeaveCC, cond);
240+
assm->vmov(dest.high(), scratch, scratch);
241+
}
242+
222243
} // namespace liftoff
223244

224245
int LiftoffAssembler::PrepareStackFrame() {
@@ -2263,7 +2284,9 @@ void LiftoffAssembler::emit_i8x16_eq(LiftoffRegister dst, LiftoffRegister lhs,
22632284

22642285
void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
22652286
LiftoffRegister rhs) {
2266-
bailout(kSimd, "i8x16_ne");
2287+
vceq(Neon8, liftoff::GetSimd128Register(dst),
2288+
liftoff::GetSimd128Register(lhs), liftoff::GetSimd128Register(rhs));
2289+
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
22672290
}
22682291

22692292
void LiftoffAssembler::emit_i16x8_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -2274,7 +2297,9 @@ void LiftoffAssembler::emit_i16x8_eq(LiftoffRegister dst, LiftoffRegister lhs,
22742297

22752298
void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
22762299
LiftoffRegister rhs) {
2277-
bailout(kSimd, "i16x8_ne");
2300+
vceq(Neon16, liftoff::GetSimd128Register(dst),
2301+
liftoff::GetSimd128Register(lhs), liftoff::GetSimd128Register(rhs));
2302+
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
22782303
}
22792304

22802305
void LiftoffAssembler::emit_i32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -2285,7 +2310,9 @@ void LiftoffAssembler::emit_i32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
22852310

22862311
void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
22872312
LiftoffRegister rhs) {
2288-
bailout(kSimd, "i32x4_ne");
2313+
vceq(Neon32, liftoff::GetSimd128Register(dst),
2314+
liftoff::GetSimd128Register(lhs), liftoff::GetSimd128Register(rhs));
2315+
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
22892316
}
22902317

22912318
void LiftoffAssembler::emit_f32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -2296,32 +2323,19 @@ void LiftoffAssembler::emit_f32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
22962323

22972324
void LiftoffAssembler::emit_f32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
22982325
LiftoffRegister rhs) {
2299-
bailout(kSimd, "f32x4_ne");
2326+
vceq(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(lhs),
2327+
liftoff::GetSimd128Register(rhs));
2328+
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
23002329
}
23012330

23022331
void LiftoffAssembler::emit_f64x2_eq(LiftoffRegister dst, LiftoffRegister lhs,
23032332
LiftoffRegister rhs) {
2304-
QwNeonRegister dest = liftoff::GetSimd128Register(dst);
2305-
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
2306-
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
2307-
UseScratchRegisterScope temps(this);
2308-
Register scratch = temps.Acquire();
2309-
2310-
mov(scratch, Operand(0));
2311-
VFPCompareAndSetFlags(left.low(), right.low());
2312-
2313-
mov(scratch, Operand(-1), LeaveCC, eq);
2314-
vmov(dest.low(), scratch, scratch);
2315-
2316-
mov(scratch, Operand(0));
2317-
VFPCompareAndSetFlags(left.high(), right.high());
2318-
mov(scratch, Operand(-1), LeaveCC, eq);
2319-
vmov(dest.high(), scratch, scratch);
2333+
liftoff::F64x2CompareEquality(this, dst, lhs, rhs, eq);
23202334
}
23212335

23222336
void LiftoffAssembler::emit_f64x2_ne(LiftoffRegister dst, LiftoffRegister lhs,
23232337
LiftoffRegister rhs) {
2324-
bailout(kSimd, "f64x2_ne");
2338+
liftoff::F64x2CompareEquality(this, dst, lhs, rhs, ne);
23252339
}
23262340

23272341
void LiftoffAssembler::emit_s128_not(LiftoffRegister dst, LiftoffRegister src) {

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,8 @@ void LiftoffAssembler::emit_i8x16_eq(LiftoffRegister dst, LiftoffRegister lhs,
15361536

15371537
void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
15381538
LiftoffRegister rhs) {
1539-
bailout(kSimd, "i8x16_ne");
1539+
Cmeq(dst.fp().V16B(), lhs.fp().V16B(), rhs.fp().V16B());
1540+
Mvn(dst.fp().V16B(), dst.fp().V16B());
15401541
}
15411542

15421543
void LiftoffAssembler::emit_i16x8_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1546,7 +1547,8 @@ void LiftoffAssembler::emit_i16x8_eq(LiftoffRegister dst, LiftoffRegister lhs,
15461547

15471548
void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
15481549
LiftoffRegister rhs) {
1549-
bailout(kSimd, "i16x8_ne");
1550+
Cmeq(dst.fp().V8H(), lhs.fp().V8H(), rhs.fp().V8H());
1551+
Mvn(dst.fp().V8H(), dst.fp().V8H());
15501552
}
15511553

15521554
void LiftoffAssembler::emit_i32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1556,7 +1558,8 @@ void LiftoffAssembler::emit_i32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
15561558

15571559
void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
15581560
LiftoffRegister rhs) {
1559-
bailout(kSimd, "i32x4_ne");
1561+
Cmeq(dst.fp().V4S(), lhs.fp().V4S(), rhs.fp().V4S());
1562+
Mvn(dst.fp().V4S(), dst.fp().V4S());
15601563
}
15611564

15621565
void LiftoffAssembler::emit_f32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1566,7 +1569,8 @@ void LiftoffAssembler::emit_f32x4_eq(LiftoffRegister dst, LiftoffRegister lhs,
15661569

15671570
void LiftoffAssembler::emit_f32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
15681571
LiftoffRegister rhs) {
1569-
bailout(kSimd, "f32x4_ne");
1572+
Fcmeq(dst.fp().V4S(), lhs.fp().V4S(), rhs.fp().V4S());
1573+
Mvn(dst.fp().V4S(), dst.fp().V4S());
15701574
}
15711575

15721576
void LiftoffAssembler::emit_f64x2_eq(LiftoffRegister dst, LiftoffRegister lhs,
@@ -1576,7 +1580,8 @@ void LiftoffAssembler::emit_f64x2_eq(LiftoffRegister dst, LiftoffRegister lhs,
15761580

15771581
void LiftoffAssembler::emit_f64x2_ne(LiftoffRegister dst, LiftoffRegister lhs,
15781582
LiftoffRegister rhs) {
1579-
bailout(kSimd, "f64x2_ne");
1583+
Fcmeq(dst.fp().V2D(), lhs.fp().V2D(), rhs.fp().V2D());
1584+
Mvn(dst.fp().V2D(), dst.fp().V2D());
15801585
}
15811586

15821587
void LiftoffAssembler::emit_s128_not(LiftoffRegister dst, LiftoffRegister src) {

0 commit comments

Comments
 (0)