aboutsummaryrefslogtreecommitdiff
path: root/riscv/decode.h
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2020-05-21 20:01:32 -0700
committerChih-Min Chao <chihmin.chao@sifive.com>2020-05-21 20:45:57 -0700
commit857ebb501199938327e9d25db45ccc13d646d4f6 (patch)
treeebc5cf3ea58f60311bffc49dadb40118c6c0c017 /riscv/decode.h
parent7eed9371f79f5c8f4675078d11a0228af9b5f571 (diff)
downloadspike-857ebb501199938327e9d25db45ccc13d646d4f6.zip
spike-857ebb501199938327e9d25db45ccc13d646d4f6.tar.gz
spike-857ebb501199938327e9d25db45ccc13d646d4f6.tar.bz2
rvv: remove vmlen
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/decode.h')
-rw-r--r--riscv/decode.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 55cbfbe..5baef00 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -393,9 +393,8 @@ inline long double to_f(float128_t f){long double r; memcpy(&r, &f, sizeof(r));
// vector: masking skip helper
//
#define VI_MASK_VARS \
- const int mlen = P.VU.vmlen; \
- const int midx = (mlen * i) / 64; \
- const int mpos = (mlen * i) % 64;
+ const int midx = i / 64; \
+ const int mpos = i % 64;
#define VI_LOOP_ELEMENT_SKIP(BODY) \
VI_MASK_VARS \
@@ -607,7 +606,7 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
reg_t rs2_num = insn.rs2(); \
for (reg_t i=P.VU.vstart; i<vl; ++i){ \
VI_LOOP_ELEMENT_SKIP(); \
- uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos); \
+ uint64_t mmask = UINT64_C(1) << mpos; \
uint64_t &vdi = P.VU.elt<uint64_t>(insn.rd(), midx, true); \
uint64_t res = 0;
@@ -621,10 +620,9 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
require_vector;\
reg_t vl = P.VU.vl; \
for (reg_t i = P.VU.vstart; i < vl; ++i) { \
- int mlen = P.VU.vmlen; \
- int midx = (mlen * i) / 64; \
- int mpos = (mlen * i) % 64; \
- uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos); \
+ int midx = i / 64; \
+ int mpos = i % 64; \
+ uint64_t mmask = UINT64_C(1) << mpos; \
uint64_t vs2 = P.VU.elt<uint64_t>(insn.rs2(), midx); \
uint64_t vs1 = P.VU.elt<uint64_t>(insn.rs1(), midx); \
uint64_t &res = P.VU.elt<uint64_t>(insn.rd(), midx, true); \
@@ -1826,7 +1824,7 @@ for (reg_t i = 0; i < P.VU.vlmax && P.VU.vl != 0; ++i) { \
float32_t vs1 = P.VU.elt<float32_t>(rs1_num, i); \
float32_t rs1 = f32(READ_FREG(rs1_num)); \
VI_LOOP_ELEMENT_SKIP(); \
- uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos); \
+ uint64_t mmask = UINT64_C(1) << mpos; \
uint64_t &vdi = P.VU.elt<uint64_t>(rd_num, midx, true); \
uint64_t res = 0;