aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2019-05-15 23:48:02 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2019-05-19 21:26:10 -0700
commitce94de9459f5a1b88c2827ebe75c6589831b474b (patch)
tree8f99817dd06c1ec5c80295bb22ff484ab6195322
parent9641f5487569a204267c34d1037e4f3dceba54ff (diff)
downloadspike-ce94de9459f5a1b88c2827ebe75c6589831b474b.zip
spike-ce94de9459f5a1b88c2827ebe75c6589831b474b.tar.gz
spike-ce94de9459f5a1b88c2827ebe75c6589831b474b.tar.bz2
rvv: add tail zeroing for floating reduction
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
-rw-r--r--riscv/decode.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 7071abb..2e472e9 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -1217,6 +1217,17 @@ VI_LOOP_END
P.VU.vstart = 0; \
set_fp_exceptions;
+#define VF_LOOP_REDUCTION_END(x) \
+ } \
+ P.VU.vstart = 0; \
+ set_fp_exceptions; \
+ if (vl > 0) { \
+ P.VU.elt<type_sew_t<x>::type>(rd_num, 0) = vd_0.v; \
+ for (reg_t i = 1; i < P.VU.VLEN / x; ++i) { \
+ P.VU.elt<type_sew_t<x>::type>(rd_num, i) = 0; \
+ } \
+ }
+
#define VF_LOOP_CMP_END \
switch(P.VU.vsew) { \
case 32: { \
@@ -1266,16 +1277,14 @@ VI_LOOP_END
BODY; \
vd = i == 0? vd: 0;\
DEBUG_RVV_FP_VV; \
- VF_LOOP_END \
- P.VU.elt<float32_t>(rd_num, 0) = vd_0;
+ VF_LOOP_REDUCTION_END(e32)
#define VFP_VV_LOOP_WIDE_REDUCTION(BODY) \
VF_LOOP_WIDE_REDUCTION_BASE \
float64_t vs2 = f64(P.VU.elt<float32_t>(rs2_num, i).v); \
BODY; \
DEBUG_RVV_FP_VV; \
- VF_LOOP_END \
- P.VU.elt<float64_t>(rd_num, 0) = vd_0;
+ VF_LOOP_REDUCTION_END(e64)
#define VFP_VF_LOOP(BODY) \
VF_LOOP_BASE \