Skip to content

Commit bbaec51

Browse files
authored
Merge pull request #1915 from chihminchao/fix_undefined_behavior
cosim: right shift can't be applied on negative number
2 parents bfb67c1 + 4973c80 commit bbaec51

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

riscv/insns/vnsra_wi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// vnsra.vi vd, vs2, zimm5
22
VI_VI_LOOP_NSHIFT
33
({
4-
vd = vs2 >> (zimm5 & (sew * 2 - 1) & 0x1f);
4+
vd = vs2 >> (zimm5 & (sew * 2 - 1));
55
})

riscv/insns/vsll_vi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// vsll.vi vd, vs2, zimm5
2-
VI_VI_LOOP
2+
VI_VI_ULOOP
33
({
4-
vd = vs2 << (simm5 & (sew - 1) & 0x1f);
4+
vd = vs2 << (zimm5 & (sew - 1));
55
})

riscv/insns/vsll_vv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// vsll
2-
VI_VV_LOOP
2+
VI_VV_ULOOP
33
({
44
vd = vs2 << (vs1 & (sew - 1));
55
})

riscv/insns/vsll_vx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// vsll
2-
VI_VX_LOOP
2+
VI_VX_ULOOP
33
({
44
vd = vs2 << (rs1 & (sew - 1));
55
})

riscv/insns/vsrl_vi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// vsrl.vi vd, vs2, zimm5
22
VI_VI_ULOOP
33
({
4-
vd = vs2 >> (zimm5 & (sew - 1) & 0x1f);
4+
vd = vs2 >> (zimm5 & (sew - 1));
55
})

riscv/insns/vssra_vi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
VI_VI_LOOP
33
({
44
VRM xrm = P.VU.get_vround_mode();
5-
int sh = simm5 & (sew - 1) & 0x1f;
5+
int sh = simm5 & (sew - 1);
66
int128_t val = vs2;
77

88
INT_ROUNDING(val, xrm, sh);

riscv/insns/vssrl_vi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
VI_VI_ULOOP
33
({
44
VRM xrm = P.VU.get_vround_mode();
5-
int sh = zimm5 & (sew - 1) & 0x1f;
5+
int sh = zimm5 & (sew - 1);
66
uint128_t val = vs2;
77

88
INT_ROUNDING(val, xrm, sh);

0 commit comments

Comments
 (0)