@@ -12582,6 +12582,19 @@ instruct countTrailingZerosL_cnttzd(iRegIdst dst, iRegLsrc src) %{
1258212582 ins_pipe(pipe_class_default);
1258312583%}
1258412584
12585+ // Expand nodes for byte_reverse_int/ushort/short.
12586+ instruct rlwinm(iRegIdst dst, iRegIsrc src, immI16 shift, immI16 mb, immI16 me) %{
12587+ effect(DEF dst, USE src, USE shift, USE mb, USE me);
12588+ predicate(false);
12589+
12590+ format %{ "RLWINM $dst, $src, $shift, $mb, $me" %}
12591+ size(4);
12592+ ins_encode %{
12593+ __ rlwinm($dst$$Register, $src$$Register, $shift$$constant, $mb$$constant, $me$$constant);
12594+ %}
12595+ ins_pipe(pipe_class_default);
12596+ %}
12597+
1258512598// Expand nodes for byte_reverse_int.
1258612599instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 n, immI16 b) %{
1258712600 effect(DEF dst, USE src, USE n, USE b);
@@ -12738,34 +12751,22 @@ instruct bytes_reverse_long(iRegLdst dst, iRegLsrc src) %{
1273812751 ins_pipe(pipe_class_default);
1273912752%}
1274012753
12754+ // Need zero extend. Must not use brh only.
1274112755instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
1274212756 match(Set dst (ReverseBytesUS src));
12743- predicate(!UseByteReverseInstructions);
1274412757 ins_cost(2*DEFAULT_COST);
1274512758
1274612759 expand %{
12760+ immI16 imm31 %{ (int) 31 %}
12761+ immI16 imm24 %{ (int) 24 %}
1274712762 immI16 imm16 %{ (int) 16 %}
1274812763 immI16 imm8 %{ (int) 8 %}
1274912764
12750- urShiftI_reg_imm (dst, src, imm8 );
12765+ rlwinm (dst, src, imm24, imm24, imm31 );
1275112766 insrwi(dst, src, imm8, imm16);
1275212767 %}
1275312768%}
1275412769
12755- instruct bytes_reverse_ushort(iRegIdst dst, iRegIsrc src) %{
12756- match(Set dst (ReverseBytesUS src));
12757- predicate(UseByteReverseInstructions);
12758- ins_cost(DEFAULT_COST);
12759- size(4);
12760-
12761- format %{ "BRH $dst, $src" %}
12762-
12763- ins_encode %{
12764- __ brh($dst$$Register, $src$$Register);
12765- %}
12766- ins_pipe(pipe_class_default);
12767- %}
12768-
1276912770instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
1277012771 match(Set dst (ReverseBytesS src));
1277112772 predicate(!UseByteReverseInstructions);
0 commit comments