aboutsummaryrefslogtreecommitdiff
path: root/riscv/decode.h
diff options
context:
space:
mode:
authorYueh-Ting (eop) Chen <yueh.ting.chen@gmail.com>2021-12-01 03:37:05 +0800
committerGitHub <noreply@github.com>2021-11-30 11:37:05 -0800
commit6507ccc30f29948a81661048e8a0ac3ae8e9a436 (patch)
tree5eaccb53d2cd4f6a0d668c332237b120cb93cae7 /riscv/decode.h
parent2b261c9782310c08da2ba112792105f3ea8125b0 (diff)
downloadspike-6507ccc30f29948a81661048e8a0ac3ae8e9a436.zip
spike-6507ccc30f29948a81661048e8a0ac3ae8e9a436.tar.gz
spike-6507ccc30f29948a81661048e8a0ac3ae8e9a436.tar.bz2
Simplify mulhsu (#870)
Diffstat (limited to 'riscv/decode.h')
-rw-r--r--riscv/decode.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 2eccce2..47df451 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -738,6 +738,16 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
type_sew_t<x>::type &vd = P.VU.elt<type_sew_t<x>::type>(rd_num, i, true); \
type_usew_t<x>::type vs2 = P.VU.elt<type_usew_t<x>::type>(rs2_num, RS1);
+#define VV_SU_PARAMS(x) \
+ type_sew_t<x>::type &vd = P.VU.elt<type_sew_t<x>::type>(rd_num, i, true); \
+ type_usew_t<x>::type vs1 = P.VU.elt<type_usew_t<x>::type>(rs1_num, i); \
+ type_sew_t<x>::type vs2 = P.VU.elt<type_sew_t<x>::type>(rs2_num, i);
+
+#define VX_SU_PARAMS(x) \
+ type_sew_t<x>::type &vd = P.VU.elt<type_sew_t<x>::type>(rd_num, i, true); \
+ type_usew_t<x>::type rs1 = (type_usew_t<x>::type)RS1; \
+ type_sew_t<x>::type vs2 = P.VU.elt<type_sew_t<x>::type>(rs2_num, i);
+
#define VV_UCMP_PARAMS(x) \
type_usew_t<x>::type vs1 = P.VU.elt<type_usew_t<x>::type>(rs1_num, i); \
type_usew_t<x>::type vs2 = P.VU.elt<type_usew_t<x>::type>(rs2_num, i);
@@ -1112,6 +1122,43 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
} \
VI_LOOP_END
+// signed unsigned operation loop (e.g. mulhsu)
+#define VI_VV_SU_LOOP(BODY) \
+ VI_CHECK_SSS(true) \
+ VI_LOOP_BASE \
+ if (sew == e8){ \
+ VV_SU_PARAMS(e8); \
+ BODY; \
+ }else if(sew == e16){ \
+ VV_SU_PARAMS(e16); \
+ BODY; \
+ }else if(sew == e32){ \
+ VV_SU_PARAMS(e32); \
+ BODY; \
+ }else if(sew == e64){ \
+ VV_SU_PARAMS(e64); \
+ BODY; \
+ } \
+ VI_LOOP_END
+
+#define VI_VX_SU_LOOP(BODY) \
+ VI_CHECK_SSS(false) \
+ VI_LOOP_BASE \
+ if (sew == e8){ \
+ VX_SU_PARAMS(e8); \
+ BODY; \
+ }else if(sew == e16){ \
+ VX_SU_PARAMS(e16); \
+ BODY; \
+ }else if(sew == e32){ \
+ VX_SU_PARAMS(e32); \
+ BODY; \
+ }else if(sew == e64){ \
+ VX_SU_PARAMS(e64); \
+ BODY; \
+ } \
+ VI_LOOP_END
+
// narrow operation loop
#define VI_VV_LOOP_NARROW(BODY) \
VI_NARROW_CHECK_COMMON; \