Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1914,13 +1914,16 @@ 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:
case Op_CountLeadingZerosL:
case Op_CountTrailingZerosI:
case Op_CountTrailingZerosL:
return UseZbb;

case Op_FmaF:
case Op_FmaD:
case Op_FmaVF:
Expand Down Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/riscv_b.ad
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,27 @@ 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));
%}

ins_pipe(ialu_reg);
%}

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));
%}

Expand Down