The instructions have the same function as RVV1.0. Overall there are only
general differences between XTheadVector and RVV1.0.
Signed-off-by: Huang Tao <eric.huang@linux.alibaba.com>
---
target/riscv/helper.h | 13 +++++++++
.../riscv/insn_trans/trans_xtheadvector.c.inc | 10 ++++---
target/riscv/xtheadvector_helper.c | 27 +++++++++++++++++++
3 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/target/riscv/helper.h b/target/riscv/helper.h
index 5aa12f3719..86ae984430 100644
--- a/target/riscv/helper.h
+++ b/target/riscv/helper.h
@@ -2120,3 +2120,16 @@ DEF_HELPER_6(th_vfwnmsac_vf_w, void, ptr, ptr, i64, ptr, env, i32)
DEF_HELPER_5(th_vfsqrt_v_h, void, ptr, ptr, ptr, env, i32)
DEF_HELPER_5(th_vfsqrt_v_w, void, ptr, ptr, ptr, env, i32)
DEF_HELPER_5(th_vfsqrt_v_d, void, ptr, ptr, ptr, env, i32)
+
+DEF_HELPER_6(th_vfmin_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmin_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmin_vv_d, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vv_h, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vv_w, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vv_d, void, ptr, ptr, ptr, ptr, env, i32)
+DEF_HELPER_6(th_vfmin_vf_h, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(th_vfmin_vf_w, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(th_vfmin_vf_d, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vf_h, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vf_w, void, ptr, ptr, i64, ptr, env, i32)
+DEF_HELPER_6(th_vfmax_vf_d, void, ptr, ptr, i64, ptr, env, i32)
diff --git a/target/riscv/insn_trans/trans_xtheadvector.c.inc b/target/riscv/insn_trans/trans_xtheadvector.c.inc
index e709444e9f..d3205ce2a0 100644
--- a/target/riscv/insn_trans/trans_xtheadvector.c.inc
+++ b/target/riscv/insn_trans/trans_xtheadvector.c.inc
@@ -2092,16 +2092,18 @@ static bool trans_##NAME(DisasContext *s, arg_rmr *a) \
GEN_OPFV_TRANS_TH(th_vfsqrt_v, opfv_check_th)
+/* Vector Floating-Point MIN/MAX Instructions */
+GEN_OPFVV_TRANS_TH(th_vfmin_vv, opfvv_check_th)
+GEN_OPFVV_TRANS_TH(th_vfmax_vv, opfvv_check_th)
+GEN_OPFVF_TRANS_TH(th_vfmin_vf, opfvf_check_th)
+GEN_OPFVF_TRANS_TH(th_vfmax_vf, opfvf_check_th)
+
#define TH_TRANS_STUB(NAME) \
static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
{ \
return require_xtheadvector(s); \
}
-TH_TRANS_STUB(th_vfmin_vv)
-TH_TRANS_STUB(th_vfmin_vf)
-TH_TRANS_STUB(th_vfmax_vv)
-TH_TRANS_STUB(th_vfmax_vf)
TH_TRANS_STUB(th_vfsgnj_vv)
TH_TRANS_STUB(th_vfsgnj_vf)
TH_TRANS_STUB(th_vfsgnjn_vv)
diff --git a/target/riscv/xtheadvector_helper.c b/target/riscv/xtheadvector_helper.c
index 7274e7aedb..5593cace78 100644
--- a/target/riscv/xtheadvector_helper.c
+++ b/target/riscv/xtheadvector_helper.c
@@ -2983,3 +2983,30 @@ THCALL(TH_OPFVV1, th_vfsqrt_v_d, OP_UU_D, H8, H8, float64_sqrt)
GEN_TH_V_ENV(th_vfsqrt_v_h, 2, 2, clearh_th)
GEN_TH_V_ENV(th_vfsqrt_v_w, 4, 4, clearl_th)
GEN_TH_V_ENV(th_vfsqrt_v_d, 8, 8, clearq_th)
+
+/* Vector Floating-Point MIN/MAX Instructions */
+THCALL(TH_OPFVV2, th_vfmin_vv_h, OP_UUU_H, H2, H2, H2, float16_minnum)
+THCALL(TH_OPFVV2, th_vfmin_vv_w, OP_UUU_W, H4, H4, H4, float32_minnum)
+THCALL(TH_OPFVV2, th_vfmin_vv_d, OP_UUU_D, H8, H8, H8, float64_minnum)
+GEN_TH_VV_ENV(th_vfmin_vv_h, 2, 2, clearh_th)
+GEN_TH_VV_ENV(th_vfmin_vv_w, 4, 4, clearl_th)
+GEN_TH_VV_ENV(th_vfmin_vv_d, 8, 8, clearq_th)
+THCALL(TH_OPFVF2, th_vfmin_vf_h, OP_UUU_H, H2, H2, float16_minnum)
+THCALL(TH_OPFVF2, th_vfmin_vf_w, OP_UUU_W, H4, H4, float32_minnum)
+THCALL(TH_OPFVF2, th_vfmin_vf_d, OP_UUU_D, H8, H8, float64_minnum)
+GEN_TH_VF(th_vfmin_vf_h, 2, 2, clearh_th)
+GEN_TH_VF(th_vfmin_vf_w, 4, 4, clearl_th)
+GEN_TH_VF(th_vfmin_vf_d, 8, 8, clearq_th)
+
+THCALL(TH_OPFVV2, th_vfmax_vv_h, OP_UUU_H, H2, H2, H2, float16_maxnum)
+THCALL(TH_OPFVV2, th_vfmax_vv_w, OP_UUU_W, H4, H4, H4, float32_maxnum)
+THCALL(TH_OPFVV2, th_vfmax_vv_d, OP_UUU_D, H8, H8, H8, float64_maxnum)
+GEN_TH_VV_ENV(th_vfmax_vv_h, 2, 2, clearh_th)
+GEN_TH_VV_ENV(th_vfmax_vv_w, 4, 4, clearl_th)
+GEN_TH_VV_ENV(th_vfmax_vv_d, 8, 8, clearq_th)
+THCALL(TH_OPFVF2, th_vfmax_vf_h, OP_UUU_H, H2, H2, float16_maxnum)
+THCALL(TH_OPFVF2, th_vfmax_vf_w, OP_UUU_W, H4, H4, float32_maxnum)
+THCALL(TH_OPFVF2, th_vfmax_vf_d, OP_UUU_D, H8, H8, float64_maxnum)
+GEN_TH_VF(th_vfmax_vf_h, 2, 2, clearh_th)
+GEN_TH_VF(th_vfmax_vf_w, 4, 4, clearl_th)
+GEN_TH_VF(th_vfmax_vf_d, 8, 8, clearq_th)
--
2.44.0