From 642084629a9a793a055cba8a950fdb61b7450093 Mon Sep 17 00:00:00 2001 From: Hamlin Li Date: Thu, 20 Jun 2024 10:10:54 +0000 Subject: [PATCH] 8334396: RISC-V: verify perf of ReverseBytesI/L Reviewed-by: fyang, rehn --- src/hotspot/cpu/riscv/riscv.ad | 31 +++---------------------------- src/hotspot/cpu/riscv/riscv_b.ad | 4 ++-- 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 54053148758..2368a280bf2 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -1914,6 +1914,8 @@ bool Matcher::match_rule_supported(int opcode) { case Op_PopCountL: return UsePopCountInstruction; + case Op_ReverseBytesI: + case Op_ReverseBytesL: case Op_RotateRight: case Op_RotateLeft: case Op_CountLeadingZerosI: @@ -1921,6 +1923,7 @@ bool Matcher::match_rule_supported(int opcode) { case Op_CountTrailingZerosI: case Op_CountTrailingZerosL: return UseZbb; + case Op_FmaF: case Op_FmaD: case Op_FmaVF: @@ -7856,34 +7859,6 @@ instruct xorL_reg_imm(iRegLNoSp dst, iRegL src1, immLAdd src2) %{ // ============================================================================ // BSWAP Instructions -instruct bytes_reverse_int(iRegINoSp dst, iRegIorL2I src, rFlagsReg cr) %{ - match(Set dst (ReverseBytesI src)); - effect(KILL cr); - - ins_cost(ALU_COST * 13); - format %{ "revb_w_w $dst, $src\t#@bytes_reverse_int" %} - - ins_encode %{ - __ revb_w_w(as_Register($dst$$reg), as_Register($src$$reg)); - %} - - ins_pipe(pipe_class_default); -%} - -instruct bytes_reverse_long(iRegLNoSp dst, iRegL src, rFlagsReg cr) %{ - match(Set dst (ReverseBytesL src)); - effect(KILL cr); - - ins_cost(ALU_COST * 29); - format %{ "revb $dst, $src\t#@bytes_reverse_long" %} - - ins_encode %{ - __ revb(as_Register($dst$$reg), as_Register($src$$reg)); - %} - - ins_pipe(pipe_class_default); -%} - instruct bytes_reverse_unsigned_short(iRegINoSp dst, iRegIorL2I src) %{ match(Set dst (ReverseBytesUS src)); diff --git a/src/hotspot/cpu/riscv/riscv_b.ad b/src/hotspot/cpu/riscv/riscv_b.ad index b8960e5e9fd..9e78159d24f 100644 --- a/src/hotspot/cpu/riscv/riscv_b.ad +++ b/src/hotspot/cpu/riscv/riscv_b.ad @@ -178,13 +178,13 @@ instruct convI2UL_reg_reg_b(iRegLNoSp dst, iRegIorL2I src, immL_32bits mask) %{ // BSWAP instructions instruct bytes_reverse_int_b(iRegINoSp dst, iRegIorL2I src) %{ - predicate(UseZbb); match(Set dst (ReverseBytesI src)); ins_cost(ALU_COST * 2); format %{ "revb_w_w $dst, $src\t#@bytes_reverse_int_b" %} ins_encode %{ + assert(UseZbb, "must be"); __ revb_w_w(as_Register($dst$$reg), as_Register($src$$reg)); %} @@ -192,13 +192,13 @@ instruct bytes_reverse_int_b(iRegINoSp dst, iRegIorL2I src) %{ %} instruct bytes_reverse_long_b(iRegLNoSp dst, iRegL src) %{ - predicate(UseZbb); match(Set dst (ReverseBytesL src)); ins_cost(ALU_COST); format %{ "rev8 $dst, $src\t#@bytes_reverse_long_b" %} ins_encode %{ + assert(UseZbb, "must be"); __ rev8(as_Register($dst$$reg), as_Register($src$$reg)); %}