aboutsummaryrefslogtreecommitdiff
path: root/riscv/decode.h
diff options
context:
space:
mode:
authorYueh-Ting (eop) Chen <yueh.ting.chen@gmail.com>2021-12-08 03:18:45 +0800
committerGitHub <noreply@github.com>2021-12-07 11:18:45 -0800
commit8f16ed328f13eb00fdae921b2e6adf8d6e528f0b (patch)
tree9b12823d9babd725c43b58c48af4f6260e6181b1 /riscv/decode.h
parent522d8a20b7bf4ab5cad0ceaa3b45155fb6d08f76 (diff)
downloadspike-8f16ed328f13eb00fdae921b2e6adf8d6e528f0b.zip
spike-8f16ed328f13eb00fdae921b2e6adf8d6e528f0b.tar.gz
spike-8f16ed328f13eb00fdae921b2e6adf8d6e528f0b.tar.bz2
Simplify vadc and vsbc (#876)
Diffstat (limited to 'riscv/decode.h')
-rw-r--r--riscv/decode.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 313d9f0..c21808f 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -644,6 +644,12 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
vd = (vd & ~mmask) | (((res) << mpos) & mmask); \
} \
P.VU.vstart->write(0);
+#define VI_LOOP_WITH_CARRY_BASE \
+ VI_GENERAL_LOOP_BASE \
+ VI_MASK_VARS \
+ auto &v0 = P.VU.elt<uint64_t>(0, midx); \
+ const uint128_t op_mask = (UINT64_MAX >> (64 - sew)); \
+ uint64_t carry = (v0 >> mpos) & 0x1;
#define VI_LOOP_CMP_BASE \
require(P.VU.vsew >= e8 && P.VU.vsew <= e64); \
@@ -1452,10 +1458,9 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
VI_LOOP_CARRY_END
#define VI_VV_LOOP_WITH_CARRY(BODY) \
- require(insn.rd() != 0); \
+ require_vm; \
VI_CHECK_SSS(true); \
- VI_GENERAL_LOOP_BASE \
- VI_MASK_VARS \
+ VI_LOOP_WITH_CARRY_BASE \
if (sew == e8){ \
VV_WITH_CARRY_PARAMS(e8) \
BODY; \
@@ -1472,10 +1477,9 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
VI_LOOP_END
#define VI_XI_LOOP_WITH_CARRY(BODY) \
- require(insn.rd() != 0); \
+ require_vm; \
VI_CHECK_SSS(false); \
- VI_GENERAL_LOOP_BASE \
- VI_MASK_VARS \
+ VI_LOOP_WITH_CARRY_BASE \
if (sew == e8){ \
XI_WITH_CARRY_PARAMS(e8) \
BODY; \