Commit 42c279e0 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

S390 [liftoff]: Implement simd integer narrowing

Change-Id: I37ebc9b8470ba0df8c62af7ccc02edf4eb38b6bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3437414Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78932}
parent 15bdd378
......@@ -5709,6 +5709,43 @@ void TurboAssembler::F32x4UConvertI32x4(Simd128Register dst,
}
#undef CONVERT_INT32_TO_FLOAT
void TurboAssembler::I16x8SConvertI32x4(Simd128Register dst,
Simd128Register src1,
Simd128Register src2) {
vpks(dst, src2, src1, Condition(0), Condition(2));
}
void TurboAssembler::I8x16SConvertI16x8(Simd128Register dst,
Simd128Register src1,
Simd128Register src2) {
vpks(dst, src2, src1, Condition(0), Condition(1));
}
#define VECTOR_PACK_UNSIGNED(dst, src1, src2, scratch, mode) \
vx(kDoubleRegZero, kDoubleRegZero, kDoubleRegZero, Condition(0), \
Condition(0), Condition(mode)); \
vmx(scratch, src1, kDoubleRegZero, Condition(0), Condition(0), \
Condition(mode)); \
vmx(dst, src2, kDoubleRegZero, Condition(0), Condition(0), Condition(mode));
void TurboAssembler::I16x8UConvertI32x4(Simd128Register dst,
Simd128Register src1,
Simd128Register src2,
Simd128Register scratch) {
// treat inputs as signed, and saturate to unsigned (negative to 0).
VECTOR_PACK_UNSIGNED(dst, src1, src2, scratch, 2)
vpkls(dst, dst, scratch, Condition(0), Condition(2));
}
void TurboAssembler::I8x16UConvertI16x8(Simd128Register dst,
Simd128Register src1,
Simd128Register src2,
Simd128Register scratch) {
// treat inputs as signed, and saturate to unsigned (negative to 0).
VECTOR_PACK_UNSIGNED(dst, src1, src2, scratch, 1)
vpkls(dst, dst, scratch, Condition(0), Condition(1));
}
#undef VECTOR_PACK_UNSIGNED
// Vector LE Load and Transform instructions.
#ifdef V8_TARGET_BIG_ENDIAN
#define IS_BIG_ENDIAN true
......
......@@ -1125,6 +1125,14 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
Simd128Register scratch1, Register scratch2);
void F32x4UConvertI32x4(Simd128Register dst, Simd128Register src,
Simd128Register scratch1, Register scratch2);
void I16x8SConvertI32x4(Simd128Register dst, Simd128Register src1,
Simd128Register src2);
void I8x16SConvertI16x8(Simd128Register dst, Simd128Register src1,
Simd128Register src2);
void I16x8UConvertI32x4(Simd128Register dst, Simd128Register src1,
Simd128Register src2, Simd128Register scratch);
void I8x16UConvertI16x8(Simd128Register dst, Simd128Register src1,
Simd128Register src2, Simd128Register scratch);
#define SIMD_UNOP_LIST(V) \
V(F64x2Abs) \
......
......@@ -2904,37 +2904,30 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
kScratchReg);
break;
}
case kS390_I16x8SConvertI32x4:
__ vpks(i.OutputSimd128Register(), i.InputSimd128Register(1),
i.InputSimd128Register(0), Condition(0), Condition(2));
break;
case kS390_I8x16SConvertI16x8:
__ vpks(i.OutputSimd128Register(), i.InputSimd128Register(1),
i.InputSimd128Register(0), Condition(0), Condition(1));
break;
#define VECTOR_PACK_UNSIGNED(mode) \
Simd128Register tempFPReg = i.ToSimd128Register(instr->TempAt(0)); \
__ vx(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg, Condition(0), \
Condition(0), Condition(mode)); \
__ vmx(tempFPReg, i.InputSimd128Register(0), kScratchDoubleReg, \
Condition(0), Condition(0), Condition(mode)); \
__ vmx(kScratchDoubleReg, i.InputSimd128Register(1), kScratchDoubleReg, \
Condition(0), Condition(0), Condition(mode));
case kS390_I16x8SConvertI32x4: {
__ I16x8SConvertI32x4(i.OutputSimd128Register(),
i.InputSimd128Register(0),
i.InputSimd128Register(1));
break;
}
case kS390_I8x16SConvertI16x8: {
__ I8x16SConvertI16x8(i.OutputSimd128Register(),
i.InputSimd128Register(0),
i.InputSimd128Register(1));
break;
}
case kS390_I16x8UConvertI32x4: {
// treat inputs as signed, and saturate to unsigned (negative to 0)
VECTOR_PACK_UNSIGNED(2)
__ vpkls(i.OutputSimd128Register(), kScratchDoubleReg, tempFPReg,
Condition(0), Condition(2));
__ I16x8UConvertI32x4(i.OutputSimd128Register(),
i.InputSimd128Register(0),
i.InputSimd128Register(1), kScratchDoubleReg);
break;
}
case kS390_I8x16UConvertI16x8: {
// treat inputs as signed, and saturate to unsigned (negative to 0)
VECTOR_PACK_UNSIGNED(1)
__ vpkls(i.OutputSimd128Register(), kScratchDoubleReg, tempFPReg,
Condition(0), Condition(1));
__ I8x16UConvertI16x8(i.OutputSimd128Register(),
i.InputSimd128Register(0),
i.InputSimd128Register(1), kScratchDoubleReg);
break;
}
#undef VECTOR_PACK_UNSIGNED
#define BINOP_EXTRACT(op, extract_high, extract_low, mode) \
Simd128Register src1 = i.InputSimd128Register(0); \
Simd128Register src2 = i.InputSimd128Register(1); \
......
......@@ -2484,6 +2484,7 @@ void InstructionSelector::VisitWord64AtomicStore(Node* node) {
V(I16x8GtU) \
V(I16x8GeU) \
V(I16x8SConvertI32x4) \
V(I16x8UConvertI32x4) \
V(I16x8RoundingAverageU) \
V(I16x8ExtMulLowI8x16S) \
V(I16x8ExtMulHighI8x16S) \
......@@ -2505,6 +2506,7 @@ void InstructionSelector::VisitWord64AtomicStore(Node* node) {
V(I8x16GtU) \
V(I8x16GeU) \
V(I8x16SConvertI16x8) \
V(I8x16UConvertI16x8) \
V(I8x16RoundingAverageU) \
V(I8x16Shl) \
V(I8x16ShrS) \
......@@ -2521,13 +2523,11 @@ void InstructionSelector::VisitWord64AtomicStore(Node* node) {
V(I16x8AddSatU) \
V(I16x8SubSatU) \
V(I16x8Q15MulRSatS) \
V(I16x8UConvertI32x4) \
V(I8x16AddSatS) \
V(I8x16SubSatS) \
V(I8x16AddSatU) \
V(I8x16SubSatU) \
V(I8x16Swizzle) \
V(I8x16UConvertI16x8)
V(I8x16Swizzle)
#define SIMD_UNOP_LIST(V) \
V(F64x2Abs) \
......
......@@ -2704,25 +2704,25 @@ void LiftoffAssembler::emit_f32x4_demote_f64x2_zero(LiftoffRegister dst,
void LiftoffAssembler::emit_i8x16_sconvert_i16x8(LiftoffRegister dst,
LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_i8x16_sconvert_i16x8");
I8x16SConvertI16x8(dst.fp(), lhs.fp(), rhs.fp());
}
void LiftoffAssembler::emit_i8x16_uconvert_i16x8(LiftoffRegister dst,
LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_i8x16_uconvert_i16x8");
I8x16UConvertI16x8(dst.fp(), lhs.fp(), rhs.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i16x8_sconvert_i32x4(LiftoffRegister dst,
LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_i16x8_sconvert_i32x4");
I16x8SConvertI32x4(dst.fp(), lhs.fp(), rhs.fp());
}
void LiftoffAssembler::emit_i16x8_uconvert_i32x4(LiftoffRegister dst,
LiftoffRegister lhs,
LiftoffRegister rhs) {
bailout(kUnsupportedArchitecture, "emit_i16x8_uconvert_i32x4");
I16x8UConvertI32x4(dst.fp(), lhs.fp(), rhs.fp(), kScratchDoubleReg);
}
void LiftoffAssembler::emit_i32x4_trunc_sat_f64x2_s_zero(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