[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v11 33/61] target/riscv: vector widening floating-point multiply
From: |
LIU Zhiwei |
Subject: |
[PATCH v11 33/61] target/riscv: vector widening floating-point multiply |
Date: |
Wed, 24 Jun 2020 05:58:52 +0800 |
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/helper.h | 5 +++++
target/riscv/insn32.decode | 2 ++
target/riscv/insn_trans/trans_rvv.inc.c | 4 ++++
target/riscv/vector_helper.c | 22 ++++++++++++++++++++++
4 files changed, 33 insertions(+)
diff --git a/target/riscv/helper.h b/target/riscv/helper.h
index 94305bd870..9d7dcfeef9 100644
--- a/target/riscv/helper.h
+++ b/target/riscv/helper.h
@@ -852,3 +852,8 @@ DEF_HELPER_6(vfdiv_vf_d, void, ptr, ptr, i64, ptr, env, i32)
DEF_HELPER_6(vfrdiv_vf_h, void, ptr, ptr, i64, ptr, env, i32)
DEF_HELPER_6(vfrdiv_vf_w, void, ptr, ptr, i64, ptr, env, i32)
DEF_HELPER_6(vfrdiv_vf_d, void, ptr, ptr, i64, ptr, env, i32)
+
+DEF_HELPER_6(vfwmul_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vfwmul_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(vfwmul_vf_h, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(vfwmul_vf_w, void, ptr, ptr, i64, ptr, env, i32)
diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode
index 5db02f0c0a..dd9bca7eeb 100644
--- a/target/riscv/insn32.decode
+++ b/target/riscv/insn32.decode
@@ -463,6 +463,8 @@ vfmul_vf 100100 . ..... ..... 101 ..... 1010111 @r_vm
vfdiv_vv 100000 . ..... ..... 001 ..... 1010111 @r_vm
vfdiv_vf 100000 . ..... ..... 101 ..... 1010111 @r_vm
vfrdiv_vf 100001 . ..... ..... 101 ..... 1010111 @r_vm
+vfwmul_vv 111000 . ..... ..... 001 ..... 1010111 @r_vm
+vfwmul_vf 111000 . ..... ..... 101 ..... 1010111 @r_vm
vsetvli 0 ........... ..... 111 ..... 1010111 @r2_zimm
vsetvl 1000000 ..... ..... 111 ..... 1010111 @r
diff --git a/target/riscv/insn_trans/trans_rvv.inc.c
b/target/riscv/insn_trans/trans_rvv.inc.c
index be9a9a8295..3ce7815f5d 100644
--- a/target/riscv/insn_trans/trans_rvv.inc.c
+++ b/target/riscv/insn_trans/trans_rvv.inc.c
@@ -2057,3 +2057,7 @@ GEN_OPFVV_TRANS(vfdiv_vv, opfvv_check)
GEN_OPFVF_TRANS(vfmul_vf, opfvf_check)
GEN_OPFVF_TRANS(vfdiv_vf, opfvf_check)
GEN_OPFVF_TRANS(vfrdiv_vf, opfvf_check)
+
+/* Vector Widening Floating-Point Multiply */
+GEN_OPFVV_WIDEN_TRANS(vfwmul_vv, opfvv_widen_check)
+GEN_OPFVF_WIDEN_TRANS(vfwmul_vf)
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 8538a63419..6441d0ee08 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -3410,3 +3410,25 @@ RVVCALL(OPFVF2, vfrdiv_vf_d, OP_UUU_D, H8, H8,
float64_rdiv)
GEN_VEXT_VF(vfrdiv_vf_h, 2, 2, clearh)
GEN_VEXT_VF(vfrdiv_vf_w, 4, 4, clearl)
GEN_VEXT_VF(vfrdiv_vf_d, 8, 8, clearq)
+
+/* Vector Widening Floating-Point Multiply */
+static uint32_t vfwmul16(uint16_t a, uint16_t b, float_status *s)
+{
+ return float32_mul(float16_to_float32(a, true, s),
+ float16_to_float32(b, true, s), s);
+}
+
+static uint64_t vfwmul32(uint32_t a, uint32_t b, float_status *s)
+{
+ return float64_mul(float32_to_float64(a, s),
+ float32_to_float64(b, s), s);
+
+}
+RVVCALL(OPFVV2, vfwmul_vv_h, WOP_UUU_H, H4, H2, H2, vfwmul16)
+RVVCALL(OPFVV2, vfwmul_vv_w, WOP_UUU_W, H8, H4, H4, vfwmul32)
+GEN_VEXT_VV_ENV(vfwmul_vv_h, 2, 4, clearl)
+GEN_VEXT_VV_ENV(vfwmul_vv_w, 4, 8, clearq)
+RVVCALL(OPFVF2, vfwmul_vf_h, WOP_UUU_H, H4, H2, vfwmul16)
+RVVCALL(OPFVF2, vfwmul_vf_w, WOP_UUU_W, H8, H4, vfwmul32)
+GEN_VEXT_VF(vfwmul_vf_h, 2, 4, clearl)
+GEN_VEXT_VF(vfwmul_vf_w, 4, 8, clearq)
--
2.23.0
- [PATCH v11 23/61] target/riscv: vector integer merge and move instructions, (continued)
- [PATCH v11 23/61] target/riscv: vector integer merge and move instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 24/61] target/riscv: vector single-width saturating add and subtract, LIU Zhiwei, 2020/06/23
- [PATCH v11 25/61] target/riscv: vector single-width averaging add and subtract, LIU Zhiwei, 2020/06/23
- [PATCH v11 26/61] target/riscv: vector single-width fractional multiply with rounding and saturation, LIU Zhiwei, 2020/06/23
- [PATCH v11 27/61] target/riscv: vector widening saturating scaled multiply-add, LIU Zhiwei, 2020/06/23
- [PATCH v11 28/61] target/riscv: vector single-width scaling shift instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 29/61] target/riscv: vector narrowing fixed-point clip instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 30/61] target/riscv: vector single-width floating-point add/subtract instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 31/61] target/riscv: vector widening floating-point add/subtract instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 32/61] target/riscv: vector single-width floating-point multiply/divide instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 33/61] target/riscv: vector widening floating-point multiply,
LIU Zhiwei <=
- [PATCH v11 34/61] target/riscv: vector single-width floating-point fused multiply-add instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 35/61] target/riscv: vector widening floating-point fused multiply-add instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 36/61] target/riscv: vector floating-point square-root instruction, LIU Zhiwei, 2020/06/23
- [PATCH v11 37/61] target/riscv: vector floating-point min/max instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 38/61] target/riscv: vector floating-point sign-injection instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 39/61] target/riscv: vector floating-point compare instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 40/61] target/riscv: vector floating-point classify instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 41/61] target/riscv: vector floating-point merge instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 42/61] target/riscv: vector floating-point/integer type-convert instructions, LIU Zhiwei, 2020/06/23
- [PATCH v11 43/61] target/riscv: widening floating-point/integer type-convert instructions, LIU Zhiwei, 2020/06/23