From c87ad0629ce97e5f0a8e843fe7c71ce153fbe8d9 Mon Sep 17 00:00:00 2001 From: Liu Yu Date: Fri, 15 Jan 2021 16:45:51 +0800 Subject: [PATCH] [mips][wasm-simd][liftoff] Implement some SIMD operations Implement i64x2 widen i32x4, and saturating rounding multiply high. Port: 9cb7e571630b0a16e52d6bb5846c8f47a8e197c8 Port: 39f2e3de65be21571c58728642577f0d579c7328 Change-Id: Ib88aca3e3f66eb4a12be4d2cf4e51ac930849cc0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2632353 Reviewed-by: Zhao Jiazhong Commit-Queue: Zhao Jiazhong Auto-Submit: Liu yu Cr-Commit-Position: refs/heads/master@{#72109} --- .../baseline/mips/liftoff-assembler-mips.h | 26 +++++++++++++++ .../mips64/liftoff-assembler-mips64.h | 32 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/src/wasm/baseline/mips/liftoff-assembler-mips.h b/src/wasm/baseline/mips/liftoff-assembler-mips.h index c12eae4c39..ccae377b55 100644 --- a/src/wasm/baseline/mips/liftoff-assembler-mips.h +++ b/src/wasm/baseline/mips/liftoff-assembler-mips.h @@ -1792,6 +1792,12 @@ SIMD_BINOP(i64x2_extmul_high_i32x4_u, ilvl_w, dotp_u_d) #undef SIMD_BINOP +void LiftoffAssembler::emit_i16x8_q15mulr_sat_s(LiftoffRegister dst, + LiftoffRegister src1, + LiftoffRegister src2) { + bailout(kSimd, "i16x8_q15mulr_sat_s"); +} + void LiftoffAssembler::emit_i8x16_eq(LiftoffRegister dst, LiftoffRegister lhs, LiftoffRegister rhs) { bailout(kSimd, "emit_i8x16_eq"); @@ -2577,6 +2583,26 @@ void LiftoffAssembler::emit_i32x4_uconvert_i16x8_high(LiftoffRegister dst, bailout(kSimd, "emit_i32x4_uconvert_i16x8_high"); } +void LiftoffAssembler::emit_i64x2_sconvert_i32x4_low(LiftoffRegister dst, + LiftoffRegister src) { + bailout(kSimd, "emit_i64x2_sconvert_i32x4_low"); +} + +void LiftoffAssembler::emit_i64x2_sconvert_i32x4_high(LiftoffRegister dst, + LiftoffRegister src) { + bailout(kSimd, "emit_i64x2_sconvert_i32x4_high"); +} + +void LiftoffAssembler::emit_i64x2_uconvert_i32x4_low(LiftoffRegister dst, + LiftoffRegister src) { + bailout(kSimd, "emit_i64x2_uconvert_i32x4_low"); +} + +void LiftoffAssembler::emit_i64x2_uconvert_i32x4_high(LiftoffRegister dst, + LiftoffRegister src) { + bailout(kSimd, "emit_i64x2_uconvert_i32x4_high"); +} + void LiftoffAssembler::emit_i8x16_rounding_average_u(LiftoffRegister dst, LiftoffRegister lhs, LiftoffRegister rhs) { diff --git a/src/wasm/baseline/mips64/liftoff-assembler-mips64.h b/src/wasm/baseline/mips64/liftoff-assembler-mips64.h index b97b423e20..b661f09416 100644 --- a/src/wasm/baseline/mips64/liftoff-assembler-mips64.h +++ b/src/wasm/baseline/mips64/liftoff-assembler-mips64.h @@ -1719,6 +1719,12 @@ SIMD_BINOP(i64x2, i32x4_u, MSAU32) #undef SIMD_BINOP +void LiftoffAssembler::emit_i16x8_q15mulr_sat_s(LiftoffRegister dst, + LiftoffRegister src1, + LiftoffRegister src2) { + mulr_q_h(dst.fp().toW(), src1.fp().toW(), src2.fp().toW()); +} + void LiftoffAssembler::emit_i8x16_eq(LiftoffRegister dst, LiftoffRegister lhs, LiftoffRegister rhs) { ceq_b(dst.fp().toW(), lhs.fp().toW(), rhs.fp().toW()); @@ -2691,6 +2697,32 @@ void LiftoffAssembler::emit_i32x4_uconvert_i16x8_high(LiftoffRegister dst, ilvl_h(dst.fp().toW(), kSimd128RegZero, src.fp().toW()); } +void LiftoffAssembler::emit_i64x2_sconvert_i32x4_low(LiftoffRegister dst, + LiftoffRegister src) { + ilvr_w(kSimd128ScratchReg, src.fp().toW(), src.fp().toW()); + slli_d(dst.fp().toW(), kSimd128ScratchReg, 32); + srai_d(dst.fp().toW(), dst.fp().toW(), 32); +} + +void LiftoffAssembler::emit_i64x2_sconvert_i32x4_high(LiftoffRegister dst, + LiftoffRegister src) { + ilvl_w(kSimd128ScratchReg, src.fp().toW(), src.fp().toW()); + slli_d(dst.fp().toW(), kSimd128ScratchReg, 32); + srai_d(dst.fp().toW(), dst.fp().toW(), 32); +} + +void LiftoffAssembler::emit_i64x2_uconvert_i32x4_low(LiftoffRegister dst, + LiftoffRegister src) { + xor_v(kSimd128RegZero, kSimd128RegZero, kSimd128RegZero); + ilvr_w(dst.fp().toW(), kSimd128RegZero, src.fp().toW()); +} + +void LiftoffAssembler::emit_i64x2_uconvert_i32x4_high(LiftoffRegister dst, + LiftoffRegister src) { + xor_v(kSimd128RegZero, kSimd128RegZero, kSimd128RegZero); + ilvl_w(dst.fp().toW(), kSimd128RegZero, src.fp().toW()); +} + void LiftoffAssembler::emit_i8x16_rounding_average_u(LiftoffRegister dst, LiftoffRegister lhs, LiftoffRegister rhs) {