aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Min Chao <chihmin.chao@sifive.com>2019-11-20 20:16:05 -0800
committerChih-Min Chao <chihmin.chao@sifive.com>2019-12-20 09:58:46 -0800
commit3379122ba9feb8644e03fff5554333283c04d2b9 (patch)
tree9da2415642aa20ed924112d513c16923ac523f78
parentf7caa6312f380b02fde8de235fde0752e01b3a54 (diff)
downloadriscv-isa-sim-3379122ba9feb8644e03fff5554333283c04d2b9.zip
riscv-isa-sim-3379122ba9feb8644e03fff5554333283c04d2b9.tar.gz
riscv-isa-sim-3379122ba9feb8644e03fff5554333283c04d2b9.tar.bz2
rvv: fix vmadc/vmsbc
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
-rw-r--r--riscv/decode.h10
-rw-r--r--riscv/insns/vmadc_vim.h2
-rw-r--r--riscv/insns/vmadc_vvm.h2
-rw-r--r--riscv/insns/vmadc_vxm.h2
-rw-r--r--riscv/insns/vmsbc_vvm.h2
-rw-r--r--riscv/insns/vmsbc_vxm.h2
6 files changed, 11 insertions, 9 deletions
diff --git a/riscv/decode.h b/riscv/decode.h
index 74dde2f..e20257e 100644
--- a/riscv/decode.h
+++ b/riscv/decode.h
@@ -1250,7 +1250,8 @@ VI_LOOP_END
// carry/borrow bit loop
#define VI_VV_LOOP_CARRY(BODY) \
VI_CHECK_MSS(true); \
- VI_LOOP_BASE \
+ VI_GENERAL_LOOP_BASE \
+ VI_MASK_VARS \
if (sew == e8){ \
VV_CARRY_PARAMS(e8) \
BODY; \
@@ -1264,11 +1265,12 @@ VI_LOOP_END
VV_CARRY_PARAMS(e64) \
BODY; \
} \
- } \
+ VI_LOOP_END
#define VI_XI_LOOP_CARRY(BODY) \
VI_CHECK_MSS(false); \
- VI_LOOP_BASE \
+ VI_GENERAL_LOOP_BASE \
+ VI_MASK_VARS \
if (sew == e8){ \
XI_CARRY_PARAMS(e8) \
BODY; \
@@ -1282,7 +1284,7 @@ VI_LOOP_END
XI_CARRY_PARAMS(e64) \
BODY; \
} \
- } \
+ VI_LOOP_END
#define VI_VV_LOOP_WITH_CARRY(BODY) \
require(insn.rd() != 0); \
diff --git a/riscv/insns/vmadc_vim.h b/riscv/insns/vmadc_vim.h
index a8185d1..36722d7 100644
--- a/riscv/insns/vmadc_vim.h
+++ b/riscv/insns/vmadc_vim.h
@@ -4,7 +4,7 @@ VI_XI_LOOP_CARRY
auto v0 = P.VU.elt<uint64_t>(0, midx);
const uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos);
const uint128_t op_mask = (UINT64_MAX >> (64 - sew));
- uint64_t carry = (v0 >> mpos) & 0x1;
+ uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0;
uint128_t res = (op_mask & simm5) + (op_mask & vs2) + carry;
diff --git a/riscv/insns/vmadc_vvm.h b/riscv/insns/vmadc_vvm.h
index 8d58658..eae71d2 100644
--- a/riscv/insns/vmadc_vvm.h
+++ b/riscv/insns/vmadc_vvm.h
@@ -4,7 +4,7 @@ VI_VV_LOOP_CARRY
auto v0 = P.VU.elt<uint64_t>(0, midx);
const uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos);
const uint128_t op_mask = (UINT64_MAX >> (64 - sew));
- uint64_t carry = (v0 >> mpos) & 0x1;
+ uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0;
uint128_t res = (op_mask & vs1) + (op_mask & vs2) + carry;
diff --git a/riscv/insns/vmadc_vxm.h b/riscv/insns/vmadc_vxm.h
index 0b6273a..3b84e6d 100644
--- a/riscv/insns/vmadc_vxm.h
+++ b/riscv/insns/vmadc_vxm.h
@@ -4,7 +4,7 @@ VI_XI_LOOP_CARRY
auto v0 = P.VU.elt<uint64_t>(0, midx);
const uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos);
const uint128_t op_mask = (UINT64_MAX >> (64 - sew));
- uint64_t carry = (v0 >> mpos) & 0x1;
+ uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0;
uint128_t res = (op_mask & rs1) + (op_mask & vs2) + carry;
diff --git a/riscv/insns/vmsbc_vvm.h b/riscv/insns/vmsbc_vvm.h
index f4ce6f4..ef8304b 100644
--- a/riscv/insns/vmsbc_vvm.h
+++ b/riscv/insns/vmsbc_vvm.h
@@ -4,7 +4,7 @@ VI_VV_LOOP_CARRY
auto v0 = P.VU.elt<uint64_t>(0, midx);
const uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos);
const uint128_t op_mask = (UINT64_MAX >> (64 - sew));
- uint64_t carry = (v0 >> mpos) & 0x1;
+ uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0;
uint128_t res = (op_mask & vs1) - (op_mask & vs2) - carry;
diff --git a/riscv/insns/vmsbc_vxm.h b/riscv/insns/vmsbc_vxm.h
index aec4409..c0e8ba2 100644
--- a/riscv/insns/vmsbc_vxm.h
+++ b/riscv/insns/vmsbc_vxm.h
@@ -4,7 +4,7 @@ VI_XI_LOOP_CARRY
auto &v0 = P.VU.elt<uint64_t>(0, midx);
const uint64_t mmask = (UINT64_MAX << (64 - mlen)) >> (64 - mlen - mpos);
const uint128_t op_mask = (UINT64_MAX >> (64 - sew));
- uint64_t carry = (v0 >> mpos) & 0x1;
+ uint64_t carry = insn.v_vm() == 0 ? (v0 >> mpos) & 0x1 : 0;
uint128_t res = (op_mask & rs1) - (op_mask & vs2) - carry;