Skip to content

Commit cc08a51

Browse files
DingliZhangRealFYang
authored andcommitted
8362596: RISC-V: Improve _vectorizedHashCode intrinsic
Backport-of: 4189fcbac40943f3b26c3a01938837b4e4762285
1 parent e58859e commit cc08a51

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,16 +1952,15 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res
19521952
mv(pow31_3, 29791); // [31^^3]
19531953
mv(pow31_2, 961); // [31^^2]
19541954

1955-
slli(chunks_end, chunks, chunks_end_shift);
1956-
add(chunks_end, ary, chunks_end);
1955+
shadd(chunks_end, chunks, ary, t0, chunks_end_shift);
19571956
andi(cnt, cnt, stride - 1); // don't forget about tail!
19581957

19591958
bind(WIDE_LOOP);
1960-
mulw(result, result, pow31_4); // 31^^4 * h
19611959
arrays_hashcode_elload(t0, Address(ary, 0 * elsize), eltype);
19621960
arrays_hashcode_elload(t1, Address(ary, 1 * elsize), eltype);
19631961
arrays_hashcode_elload(tmp5, Address(ary, 2 * elsize), eltype);
19641962
arrays_hashcode_elload(tmp6, Address(ary, 3 * elsize), eltype);
1963+
mulw(result, result, pow31_4); // 31^^4 * h
19651964
mulw(t0, t0, pow31_3); // 31^^3 * ary[i+0]
19661965
addw(result, result, t0);
19671966
mulw(t1, t1, pow31_2); // 31^^2 * ary[i+1]
@@ -1976,8 +1975,7 @@ void C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register res
19761975
beqz(cnt, DONE);
19771976

19781977
bind(TAIL);
1979-
slli(chunks_end, cnt, chunks_end_shift);
1980-
add(chunks_end, ary, chunks_end);
1978+
shadd(chunks_end, cnt, ary, t0, chunks_end_shift);
19811979

19821980
bind(TAIL_LOOP);
19831981
arrays_hashcode_elload(t0, Address(ary), eltype);

0 commit comments

Comments
 (0)