S390 [liftoff]: Implement FP promote and demote

Change-Id: Ie5eac61238442bedcb5f9d61a67cc47de261655a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3447692
Reviewed-by: Junliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#79002}
This commit is contained in:
Milad Fa 2022-02-08 15:31:07 -05:00 committed by V8 LUCI CQ
parent 934443d9dc
commit a52d45cbbb
4 changed files with 48 additions and 25 deletions

View File

@ -5876,6 +5876,40 @@ void TurboAssembler::I8x16SubSatU(Simd128Register dst, Simd128Register src1,
}
#undef BINOP_EXTRACT
void TurboAssembler::F64x2PromoteLowF32x4(Simd128Register dst,
Simd128Register src,
Simd128Register scratch1,
Register scratch2, Register scratch3,
Register scratch4) {
Register holder = scratch3;
for (int index = 0; index < 2; ++index) {
vlgv(scratch2, src, MemOperand(scratch2, index + 2), Condition(2));
MovIntToFloat(scratch1, scratch2);
ldebr(scratch1, scratch1);
MovDoubleToInt64(holder, scratch1);
holder = scratch4;
}
vlvgp(dst, scratch3, scratch4);
}
void TurboAssembler::F32x4DemoteF64x2Zero(Simd128Register dst,
Simd128Register src,
Simd128Register scratch1,
Register scratch2, Register scratch3,
Register scratch4) {
Register holder = scratch3;
for (int index = 0; index < 2; ++index) {
vlgv(scratch2, src, MemOperand(r0, index), Condition(3));
MovInt64ToDouble(scratch1, scratch2);
ledbr(scratch1, scratch1);
MovFloatToInt(holder, scratch1);
holder = scratch4;
}
vx(dst, dst, dst, Condition(0), Condition(0), Condition(2));
vlvg(dst, scratch3, MemOperand(r0, 2), Condition(2));
vlvg(dst, scratch4, MemOperand(r0, 3), Condition(2));
}
// Vector LE Load and Transform instructions.
#ifdef V8_TARGET_BIG_ENDIAN
#define IS_BIG_ENDIAN true

View File

@ -1134,6 +1134,12 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Simd128Register src2, Simd128Register scratch);
void I8x16UConvertI16x8(Simd128Register dst, Simd128Register src1,
Simd128Register src2, Simd128Register scratch);
void F64x2PromoteLowF32x4(Simd128Register dst, Simd128Register src,
Simd128Register scratch1, Register scratch2,
Register scratch3, Register scratch4);
void F32x4DemoteF64x2Zero(Simd128Register dst, Simd128Register src,
Simd128Register scratch1, Register scratch2,
Register scratch3, Register scratch4);
void S128Select(Simd128Register dst, Simd128Register src1,
Simd128Register src2, Simd128Register mask);

View File

@ -3064,32 +3064,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
break;
}
case kS390_F64x2PromoteLowF32x4: {
Register holder = r1;
for (int index = 0; index < 2; ++index) {
__ vlgv(r0, i.InputSimd128Register(0), MemOperand(r0, index + 2),
Condition(2));
__ MovIntToFloat(kScratchDoubleReg, r0);
__ ldebr(kScratchDoubleReg, kScratchDoubleReg);
__ MovDoubleToInt64(holder, kScratchDoubleReg);
holder = ip;
}
__ vlvgp(i.OutputSimd128Register(), r1, ip);
__ F64x2PromoteLowF32x4(i.OutputSimd128Register(),
i.InputSimd128Register(0), kScratchDoubleReg, r0,
r1, ip);
break;
}
case kS390_F32x4DemoteF64x2Zero: {
Simd128Register dst = i.OutputSimd128Register();
Register holder = r1;
for (int index = 0; index < 2; ++index) {
__ vlgv(r0, i.InputSimd128Register(0), MemOperand(r0, index),
Condition(3));
__ MovInt64ToDouble(kScratchDoubleReg, r0);
__ ledbr(kScratchDoubleReg, kScratchDoubleReg);
__ MovFloatToInt(holder, kScratchDoubleReg);
holder = ip;
}
__ vx(dst, dst, dst, Condition(0), Condition(0), Condition(2));
__ vlvg(dst, r1, MemOperand(r0, 2), Condition(2));
__ vlvg(dst, ip, MemOperand(r0, 3), Condition(2));
__ F32x4DemoteF64x2Zero(i.OutputSimd128Register(),
i.InputSimd128Register(0), kScratchDoubleReg, r0,
r1, ip);
break;
}
case kS390_I32x4TruncSatF64x2SZero: {

View File

@ -2581,7 +2581,7 @@ void LiftoffAssembler::emit_f64x2_convert_low_i32x4_u(LiftoffRegister dst,
void LiftoffAssembler::emit_f64x2_promote_low_f32x4(LiftoffRegister dst,
LiftoffRegister src) {
bailout(kSimd, "f64x2.promote_low_f32x4");
F64x2PromoteLowF32x4(dst.fp(), src.fp(), kScratchDoubleReg, r0, r1, ip);
}
void LiftoffAssembler::emit_i64x2_bitmask(LiftoffRegister dst,
@ -2688,7 +2688,7 @@ void LiftoffAssembler::emit_f32x4_uconvert_i32x4(LiftoffRegister dst,
void LiftoffAssembler::emit_f32x4_demote_f64x2_zero(LiftoffRegister dst,
LiftoffRegister src) {
bailout(kSimd, "f32x4.demote_f64x2_zero");
F32x4DemoteF64x2Zero(dst.fp(), src.fp(), kScratchDoubleReg, r0, r1, ip);
}
void LiftoffAssembler::emit_i8x16_sconvert_i16x8(LiftoffRegister dst,