[wasm-simd][liftoff] Implement gt on x64 and ia32

Bug: v8:9909
Change-Id: Ic75c75fa3693a59bf059cf852172900ad95a1941
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2169026
Commit-Queue: Jing Bao <jing.bao@intel.com>
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67461}
This commit is contained in:
jing.bao 2020-04-29 13:08:50 +08:00 committed by Commit Bot
parent e19d4b5393
commit 22242cb18b
6 changed files with 210 additions and 0 deletions

View File

@ -2434,6 +2434,16 @@ void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
}
void LiftoffAssembler::emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16gt_s");
}
void LiftoffAssembler::emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16gt_u");
}
void LiftoffAssembler::emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16ge_s");
@ -2457,6 +2467,16 @@ void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
}
void LiftoffAssembler::emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i16x8gt_s");
}
void LiftoffAssembler::emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i16x8gt_u");
}
void LiftoffAssembler::emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
vcge(NeonS16, liftoff::GetSimd128Register(dst),
@ -2482,6 +2502,16 @@ void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
vmvn(liftoff::GetSimd128Register(dst), liftoff::GetSimd128Register(dst));
}
void LiftoffAssembler::emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i32x4gt_s");
}
void LiftoffAssembler::emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i32x4gt_u");
}
void LiftoffAssembler::emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
vcge(NeonS32, liftoff::GetSimd128Register(dst),

View File

@ -1540,6 +1540,16 @@ void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
Mvn(dst.fp().V16B(), dst.fp().V16B());
}
void LiftoffAssembler::emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16gt_s");
}
void LiftoffAssembler::emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16gt_u");
}
void LiftoffAssembler::emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i8x16ge_s");
@ -1561,6 +1571,16 @@ void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
Mvn(dst.fp().V8H(), dst.fp().V8H());
}
void LiftoffAssembler::emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i16x8gt_s");
}
void LiftoffAssembler::emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i16x8gt_u");
}
void LiftoffAssembler::emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
Cmge(dst.fp().V8H(), lhs.fp().V8H(), rhs.fp().V8H());
@ -1582,6 +1602,16 @@ void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
Mvn(dst.fp().V4S(), dst.fp().V4S());
}
void LiftoffAssembler::emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i32x4gt_s");
}
void LiftoffAssembler::emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "i32x4gt_u");
}
void LiftoffAssembler::emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
Cmge(dst.fp().V4S(), lhs.fp().V4S(), rhs.fp().V4S());

View File

@ -2033,6 +2033,27 @@ void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtb,
&Assembler::pcmpgtb>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(liftoff::kScratchDoubleReg, rhs.fp());
ref = liftoff::kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxub, &Assembler::pmaxub>(
this, dst, lhs, rhs);
Pcmpeqb(dst.fp(), ref);
Pcmpeqb(liftoff::kScratchDoubleReg, liftoff::kScratchDoubleReg);
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
@ -2071,6 +2092,27 @@ void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtw,
&Assembler::pcmpgtw>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(liftoff::kScratchDoubleReg, rhs.fp());
ref = liftoff::kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxuw, &Assembler::pmaxuw>(
this, dst, lhs, rhs);
Pcmpeqw(dst.fp(), ref);
Pcmpeqw(liftoff::kScratchDoubleReg, liftoff::kScratchDoubleReg);
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
@ -2109,6 +2151,27 @@ void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtd,
&Assembler::pcmpgtd>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(liftoff::kScratchDoubleReg, rhs.fp());
ref = liftoff::kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxud, &Assembler::pmaxud>(
this, dst, lhs, rhs);
Pcmpeqd(dst.fp(), ref);
Pcmpeqd(liftoff::kScratchDoubleReg, liftoff::kScratchDoubleReg);
Pxor(dst.fp(), liftoff::kScratchDoubleReg);
}
void LiftoffAssembler::emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();

View File

@ -733,6 +733,10 @@ class LiftoffAssembler : public TurboAssembler {
LiftoffRegister rhs);
inline void emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i8x16_ge_u(LiftoffRegister dst, LiftoffRegister lhs,
@ -741,6 +745,10 @@ class LiftoffAssembler : public TurboAssembler {
LiftoffRegister rhs);
inline void emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i16x8_ge_u(LiftoffRegister dst, LiftoffRegister lhs,
@ -749,6 +757,10 @@ class LiftoffAssembler : public TurboAssembler {
LiftoffRegister rhs);
inline void emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs);
inline void emit_i32x4_ge_u(LiftoffRegister dst, LiftoffRegister lhs,

View File

@ -2366,6 +2366,10 @@ class LiftoffCompiler {
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i8x16_eq);
case wasm::kExprI8x16Ne:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i8x16_ne);
case wasm::kExprI8x16GtS:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i8x16_gt_s);
case wasm::kExprI8x16GtU:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i8x16_gt_u);
case wasm::kExprI8x16LeS:
return EmitBinOp<kS128, kS128, true>(
&LiftoffAssembler::emit_i8x16_ge_s);
@ -2380,6 +2384,10 @@ class LiftoffCompiler {
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i16x8_eq);
case wasm::kExprI16x8Ne:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i16x8_ne);
case wasm::kExprI16x8GtS:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i16x8_gt_s);
case wasm::kExprI16x8GtU:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i16x8_gt_u);
case wasm::kExprI16x8LeS:
return EmitBinOp<kS128, kS128, true>(
&LiftoffAssembler::emit_i16x8_ge_s);
@ -2394,6 +2402,10 @@ class LiftoffCompiler {
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i32x4_eq);
case wasm::kExprI32x4Ne:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i32x4_ne);
case wasm::kExprI32x4GtS:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i32x4_gt_s);
case wasm::kExprI32x4GtU:
return EmitBinOp<kS128, kS128>(&LiftoffAssembler::emit_i32x4_gt_u);
case wasm::kExprI32x4LeS:
return EmitBinOp<kS128, kS128, true>(
&LiftoffAssembler::emit_i32x4_ge_s);

View File

@ -1996,6 +1996,27 @@ void LiftoffAssembler::emit_i8x16_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i8x16_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtb,
&Assembler::pcmpgtb>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i8x16_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(kScratchDoubleReg, rhs.fp());
ref = kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxub, &Assembler::pmaxub>(
this, dst, lhs, rhs);
Pcmpeqb(dst.fp(), ref);
Pcmpeqb(kScratchDoubleReg, kScratchDoubleReg);
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i8x16_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
@ -2034,6 +2055,27 @@ void LiftoffAssembler::emit_i16x8_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i16x8_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtw,
&Assembler::pcmpgtw>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i16x8_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(kScratchDoubleReg, rhs.fp());
ref = kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxuw, &Assembler::pmaxuw>(
this, dst, lhs, rhs);
Pcmpeqw(dst.fp(), ref);
Pcmpeqw(kScratchDoubleReg, kScratchDoubleReg);
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i16x8_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
@ -2072,6 +2114,27 @@ void LiftoffAssembler::emit_i32x4_ne(LiftoffRegister dst, LiftoffRegister lhs,
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i32x4_gt_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
liftoff::EmitSimdNonCommutativeBinOp<&Assembler::vpcmpgtd,
&Assembler::pcmpgtd>(this, dst, lhs,
rhs);
}
void LiftoffAssembler::emit_i32x4_gt_u(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();
if (dst == rhs) {
Movaps(kScratchDoubleReg, rhs.fp());
ref = kScratchDoubleReg;
}
liftoff::EmitSimdCommutativeBinOp<&Assembler::vpmaxud, &Assembler::pmaxud>(
this, dst, lhs, rhs);
Pcmpeqd(dst.fp(), ref);
Pcmpeqd(kScratchDoubleReg, kScratchDoubleReg);
Pxor(dst.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i32x4_ge_s(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
DoubleRegister ref = rhs.fp();