8334396: RISC-V: verify perf of ReverseBytesI/L

Reviewed-by: fyang, rehn
This commit is contained in:
Hamlin Li 2024-06-20 10:10:54 +00:00
parent c6f3bf4bd6
commit 642084629a
2 changed files with 5 additions and 30 deletions

View File

@ -1914,6 +1914,8 @@ bool Matcher::match_rule_supported(int opcode) {
case Op_PopCountL: case Op_PopCountL:
return UsePopCountInstruction; return UsePopCountInstruction;
case Op_ReverseBytesI:
case Op_ReverseBytesL:
case Op_RotateRight: case Op_RotateRight:
case Op_RotateLeft: case Op_RotateLeft:
case Op_CountLeadingZerosI: case Op_CountLeadingZerosI:
@ -1921,6 +1923,7 @@ bool Matcher::match_rule_supported(int opcode) {
case Op_CountTrailingZerosI: case Op_CountTrailingZerosI:
case Op_CountTrailingZerosL: case Op_CountTrailingZerosL:
return UseZbb; return UseZbb;
case Op_FmaF: case Op_FmaF:
case Op_FmaD: case Op_FmaD:
case Op_FmaVF: case Op_FmaVF:
@ -7856,34 +7859,6 @@ instruct xorL_reg_imm(iRegLNoSp dst, iRegL src1, immLAdd src2) %{
// ============================================================================ // ============================================================================
// BSWAP Instructions // 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) %{ instruct bytes_reverse_unsigned_short(iRegINoSp dst, iRegIorL2I src) %{
match(Set dst (ReverseBytesUS src)); match(Set dst (ReverseBytesUS src));

View File

@ -178,13 +178,13 @@ instruct convI2UL_reg_reg_b(iRegLNoSp dst, iRegIorL2I src, immL_32bits mask) %{
// BSWAP instructions // BSWAP instructions
instruct bytes_reverse_int_b(iRegINoSp dst, iRegIorL2I src) %{ instruct bytes_reverse_int_b(iRegINoSp dst, iRegIorL2I src) %{
predicate(UseZbb);
match(Set dst (ReverseBytesI src)); match(Set dst (ReverseBytesI src));
ins_cost(ALU_COST * 2); ins_cost(ALU_COST * 2);
format %{ "revb_w_w $dst, $src\t#@bytes_reverse_int_b" %} format %{ "revb_w_w $dst, $src\t#@bytes_reverse_int_b" %}
ins_encode %{ ins_encode %{
assert(UseZbb, "must be");
__ revb_w_w(as_Register($dst$$reg), as_Register($src$$reg)); __ 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) %{ instruct bytes_reverse_long_b(iRegLNoSp dst, iRegL src) %{
predicate(UseZbb);
match(Set dst (ReverseBytesL src)); match(Set dst (ReverseBytesL src));
ins_cost(ALU_COST); ins_cost(ALU_COST);
format %{ "rev8 $dst, $src\t#@bytes_reverse_long_b" %} format %{ "rev8 $dst, $src\t#@bytes_reverse_long_b" %}
ins_encode %{ ins_encode %{
assert(UseZbb, "must be");
__ rev8(as_Register($dst$$reg), as_Register($src$$reg)); __ rev8(as_Register($dst$$reg), as_Register($src$$reg));
%} %}