Browse Source

rvv: fix int type is not enough to do shift (#544)

int can only represent 32 bit in lp64 model

when sew is greater than 32, the behavior is undefined
pull/548/head
Han-Kuan Chen 6 years ago
committed by GitHub
parent
commit
3e7cba464d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      riscv/insns/vrem_vv.h
  2. 2
      riscv/insns/vrem_vx.h

2
riscv/insns/vrem_vv.h

@ -3,7 +3,7 @@ VI_VV_LOOP
({
if (vs1 == 0)
vd = vs2;
else if(vs2 == -(1 << (sew - 1)) && vs1 == -1)
else if(vs2 == -(((intmax_t)1) << (sew - 1)) && vs1 == -1)
vd = 0;
else {
vd = vs2 % vs1;

2
riscv/insns/vrem_vx.h

@ -3,7 +3,7 @@ VI_VX_LOOP
({
if (rs1 == 0)
vd = vs2;
else if (vs2 == -(1 << (sew - 1)) && rs1 == -1)
else if (vs2 == -(((intmax_t)1) << (sew - 1)) && rs1 == -1)
vd = 0;
else
vd = vs2 % rs1;

Loading…
Cancel
Save