Skip to content

Commit dcb462b

Browse files
rnaxchihminchao
authored andcommitted
rvp: Fix shift amount masking in PSLL.DWS
Use 5-bit mask (0x1F) for shift amount instead of 8-bit field extraction. Spec defines rs2[4:0] as shift amount. Also removes incorrect >= 32 check that zeroed result. Fixed instruction: - PSLL.DWS: P-ext spec Changed: P_FIELD(RS2, 0, 8) with >= 32 check → RS2 & 0x1F Signed-off-by: Max Chou <max.chou@sifive.com>
1 parent 5afd1f4 commit dcb462b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

riscv/insns/psll_dws.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require_rv32;
22
P_RD_RS1_DW_LOOP(32, 32, {
3-
uint8_t m = P_FIELD(RS2, 0, 8);
3+
uint8_t m = RS2 & 0x1F;
44
const uint64_t maskN = 0xFFFFFFFFull;
5-
if (m >= 32) p_rd = 0;
6-
else p_rd = (uint32_t)((p_rs1 << m) & maskN);
5+
p_rd = (uint32_t)((p_rs1 << m) & maskN);
76
})

0 commit comments

Comments
 (0)