diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-03-27 01:30:22 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2020-03-27 03:24:42 -0700 |
commit | 7760d6d68b02a213c1128bc11e67fda750580a1c (patch) | |
tree | dec3e151ed732b7fbf618d3ea8390d23837cb549 /riscv/insns/vsmul_vx.h | |
parent | 425e39b0094907d237d62d087b146f80b9c62fc5 (diff) | |
download | spike-7760d6d68b02a213c1128bc11e67fda750580a1c.zip spike-7760d6d68b02a213c1128bc11e67fda750580a1c.tar.gz spike-7760d6d68b02a213c1128bc11e67fda750580a1c.tar.bz2 |
rvv: fix int_max/min value calculation
1. use stdint macro
2. fix vxsat status for vsmul
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'riscv/insns/vsmul_vx.h')
-rw-r--r-- | riscv/insns/vsmul_vx.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/riscv/insns/vsmul_vx.h b/riscv/insns/vsmul_vx.h index 4326d8f..cf4b511 100644 --- a/riscv/insns/vsmul_vx.h +++ b/riscv/insns/vsmul_vx.h @@ -1,7 +1,7 @@ -// vsmul +// vsmul.vx vd, vs2, rs1 VRM xrm = P.VU.get_vround_mode(); -int64_t int_max = (uint64_t(1) << (P.VU.vsew - 1)) - 1; -int64_t int_min = - (1 << (P.VU.vsew - 1)); +int64_t int_max = INT64_MAX >> (64 - P.VU.vsew); +int64_t int_min = INT64_MIN >> (64 - P.VU.vsew); int64_t sign_mask = uint64_t(1) << (P.VU.vsew - 1); VI_VX_LOOP @@ -26,7 +26,7 @@ VI_VX_LOOP // max saturation if (overflow) { result = int_max; - P.VU.vxsat = 1; + P.VU.vxsat |= 1; } vd = result; |