Commit baad3460 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][liftoff][arm][arm64] Implement pmin pmax

Implement f32x4.pmin, f32x4.pmax, f64x2.pmin, and f64x2.pmax for arm and
arm64.

Bug: v8:10904
Change-Id: Ife8b832dfc21850c2c292b0d6446b7dd3f6d9849
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2415109Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69975}
parent 8414fd56
......@@ -2407,12 +2407,34 @@ void LiftoffAssembler::emit_f64x2_max(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_f64x2_pmin(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmin unimplemented");
QwNeonRegister dest = liftoff::GetSimd128Register(dst);
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
if (dst != rhs) {
vmov(dest, left);
}
VFPCompareAndSetFlags(right.low(), left.low());
vmov(dest.low(), right.low(), mi);
VFPCompareAndSetFlags(right.high(), left.high());
vmov(dest.high(), right.high(), mi);
}
void LiftoffAssembler::emit_f64x2_pmax(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmax unimplemented");
QwNeonRegister dest = liftoff::GetSimd128Register(dst);
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
if (dst != rhs) {
vmov(dest, left);
}
VFPCompareAndSetFlags(right.low(), left.low());
vmov(dest.low(), right.low(), gt);
VFPCompareAndSetFlags(right.high(), left.high());
vmov(dest.high(), right.high(), gt);
}
void LiftoffAssembler::emit_f32x4_splat(LiftoffRegister dst,
......@@ -2536,12 +2558,40 @@ void LiftoffAssembler::emit_f32x4_max(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_f32x4_pmin(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmin unimplemented");
UseScratchRegisterScope temps(this);
QwNeonRegister tmp = liftoff::GetSimd128Register(dst);
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireQ();
}
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
vcgt(tmp, left, right);
vbsl(tmp, right, left);
if (dst == lhs || dst == rhs) {
vmov(liftoff::GetSimd128Register(dst), tmp);
}
}
void LiftoffAssembler::emit_f32x4_pmax(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmax unimplemented");
UseScratchRegisterScope temps(this);
QwNeonRegister tmp = liftoff::GetSimd128Register(dst);
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireQ();
}
QwNeonRegister left = liftoff::GetSimd128Register(lhs);
QwNeonRegister right = liftoff::GetSimd128Register(rhs);
vcgt(tmp, right, left);
vbsl(tmp, right, left);
if (dst == lhs || dst == rhs) {
vmov(liftoff::GetSimd128Register(dst), tmp);
}
}
void LiftoffAssembler::emit_i64x2_splat(LiftoffRegister dst,
......
......@@ -1620,12 +1620,36 @@ void LiftoffAssembler::emit_f64x2_max(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_f64x2_pmin(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmin unimplemented");
UseScratchRegisterScope temps(this);
VRegister tmp = dst.fp();
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireV(kFormat2D);
}
Fcmgt(tmp.V2D(), lhs.fp().V2D(), rhs.fp().V2D());
Bsl(tmp.V16B(), rhs.fp().V16B(), lhs.fp().V16B());
if (dst == lhs || dst == rhs) {
Mov(dst.fp(), tmp);
}
}
void LiftoffAssembler::emit_f64x2_pmax(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmax unimplemented");
UseScratchRegisterScope temps(this);
VRegister tmp = dst.fp();
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireV(kFormat2D);
}
Fcmgt(tmp.V2D(), rhs.fp().V2D(), lhs.fp().V2D());
Bsl(tmp.V16B(), rhs.fp().V16B(), lhs.fp().V16B());
if (dst == lhs || dst == rhs) {
Mov(dst.fp(), tmp);
}
}
void LiftoffAssembler::emit_f32x4_splat(LiftoffRegister dst,
......@@ -1720,12 +1744,36 @@ void LiftoffAssembler::emit_f32x4_max(LiftoffRegister dst, LiftoffRegister lhs,
void LiftoffAssembler::emit_f32x4_pmin(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmin unimplemented");
UseScratchRegisterScope temps(this);
VRegister tmp = dst.fp();
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireV(kFormat4S);
}
Fcmgt(tmp.V4S(), lhs.fp().V4S(), rhs.fp().V4S());
Bsl(tmp.V16B(), rhs.fp().V16B(), lhs.fp().V16B());
if (dst == lhs || dst == rhs) {
Mov(dst.fp(), tmp);
}
}
void LiftoffAssembler::emit_f32x4_pmax(LiftoffRegister dst, LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kSimd, "pmax unimplemented");
UseScratchRegisterScope temps(this);
VRegister tmp = dst.fp();
if (dst == lhs || dst == rhs) {
tmp = temps.AcquireV(kFormat4S);
}
Fcmgt(tmp.V4S(), rhs.fp().V4S(), lhs.fp().V4S());
Bsl(tmp.V16B(), rhs.fp().V16B(), lhs.fp().V16B());
if (dst == lhs || dst == rhs) {
Mov(dst.fp(), tmp);
}
}
void LiftoffAssembler::emit_i64x2_splat(LiftoffRegister dst,
......
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