@@ -12391,6 +12391,19 @@ instruct countTrailingZerosL_cnttzd(iRegIdst dst, iRegLsrc src) %{
1239112391 ins_pipe(pipe_class_default);
1239212392%}
1239312393
12394+ // Expand nodes for byte_reverse_int/ushort/short.
12395+ instruct rlwinm(iRegIdst dst, iRegIsrc src, immI16 shift, immI16 mb, immI16 me) %{
12396+ effect(DEF dst, USE src, USE shift, USE mb, USE me);
12397+ predicate(false);
12398+
12399+ format %{ "RLWINM $dst, $src, $shift, $mb, $me" %}
12400+ size(4);
12401+ ins_encode %{
12402+ __ rlwinm($dst$$Register, $src$$Register, $shift$$constant, $mb$$constant, $me$$constant);
12403+ %}
12404+ ins_pipe(pipe_class_default);
12405+ %}
12406+
1239412407// Expand nodes for byte_reverse_int.
1239512408instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 n, immI16 b) %{
1239612409 effect(DEF dst, USE src, USE n, USE b);
@@ -12547,34 +12560,22 @@ instruct bytes_reverse_long(iRegLdst dst, iRegLsrc src) %{
1254712560 ins_pipe(pipe_class_default);
1254812561%}
1254912562
12563+ // Need zero extend. Must not use brh only.
1255012564instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
1255112565 match(Set dst (ReverseBytesUS src));
12552- predicate(!UseByteReverseInstructions);
1255312566 ins_cost(2*DEFAULT_COST);
1255412567
1255512568 expand %{
12569+ immI16 imm31 %{ (int) 31 %}
12570+ immI16 imm24 %{ (int) 24 %}
1255612571 immI16 imm16 %{ (int) 16 %}
1255712572 immI16 imm8 %{ (int) 8 %}
1255812573
12559- urShiftI_reg_imm (dst, src, imm8 );
12574+ rlwinm (dst, src, imm24, imm24, imm31 );
1256012575 insrwi(dst, src, imm8, imm16);
1256112576 %}
1256212577%}
1256312578
12564- instruct bytes_reverse_ushort(iRegIdst dst, iRegIsrc src) %{
12565- match(Set dst (ReverseBytesUS src));
12566- predicate(UseByteReverseInstructions);
12567- ins_cost(DEFAULT_COST);
12568- size(4);
12569-
12570- format %{ "BRH $dst, $src" %}
12571-
12572- ins_encode %{
12573- __ brh($dst$$Register, $src$$Register);
12574- %}
12575- ins_pipe(pipe_class_default);
12576- %}
12577-
1257812579instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
1257912580 match(Set dst (ReverseBytesS src));
1258012581 predicate(!UseByteReverseInstructions);
0 commit comments