From 5cd8af7622a93afb32f5f3fccdc453096992453c Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 5 Jun 2023 15:40:10 +0000 Subject: [PATCH] 8308726: RISC-V: avoid unnecessary slli in the vectorized arraycopy stubs for bytes Reviewed-by: fyang, luhenry --- src/hotspot/cpu/riscv/stubGenerator_riscv.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 0112de0584c..0522c8070fb 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -915,7 +915,10 @@ class StubGenerator: public StubCodeGenerator { __ vlex_v(v0, src, sew); __ sub(cnt, cnt, vl); - __ slli(vl, vl, (int)sew); + if (sew != Assembler::e8) { + // when sew == e8 (e.g., elem size is 1 byte), slli R, R, 0 is a nop and unnecessary + __ slli(vl, vl, sew); + } __ add(src, src, vl); __ vsex_v(v0, dst, sew); @@ -927,7 +930,10 @@ class StubGenerator: public StubCodeGenerator { __ bind(loop_backward); __ sub(t0, cnt, vl); - __ slli(t0, t0, sew); + if (sew != Assembler::e8) { + // when sew == e8 (e.g., elem size is 1 byte), slli R, R, 0 is a nop and unnecessary + __ slli(t0, t0, sew); + } __ add(tmp1, s, t0); __ vlex_v(v0, tmp1, sew); __ add(tmp2, d, t0);