Skip to content

Commit f3b96f6

Browse files
Ilya GavrilinVladimir Kempik
Ilya Gavrilin
authored and
Vladimir Kempik
committed
8311862: RISC-V: small improvements to shift immediate instructions
Reviewed-by: luhenry, fjiang, fyang
1 parent a63f865 commit f3b96f6

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/hotspot/cpu/riscv/assembler_riscv.hpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,13 @@ enum Nf {
27872787
c_slli(Rd, shamt); \
27882788
return; \
27892789
} \
2790-
_slli(Rd, Rs1, shamt); \
2790+
if (shamt != 0) { \
2791+
_slli(Rd, Rs1, shamt); \
2792+
} else { \
2793+
if (Rd != Rs1) { \
2794+
addi(Rd, Rs1, 0); \
2795+
} \
2796+
} \
27912797
}
27922798

27932799
INSN(slli);
@@ -2802,7 +2808,13 @@ enum Nf {
28022808
C_NAME(Rd, shamt); \
28032809
return; \
28042810
} \
2805-
NORMAL_NAME(Rd, Rs1, shamt); \
2811+
if (shamt != 0) { \
2812+
NORMAL_NAME(Rd, Rs1, shamt); \
2813+
} else { \
2814+
if (Rd != Rs1) { \
2815+
addi(Rd, Rs1, 0); \
2816+
} \
2817+
} \
28062818
}
28072819

28082820
INSN(srai, c_srai, _srai);

0 commit comments

Comments
 (0)