@@ -13041,6 +13041,19 @@ instruct countTrailingZerosL_cnttzd(iRegIdst dst, iRegLsrc src) %{
1304113041 ins_pipe(pipe_class_default);
1304213042%}
1304313043
13044+ // Expand nodes for byte_reverse_int/ushort/short.
13045+ instruct rlwinm(iRegIdst dst, iRegIsrc src, immI16 shift, immI16 mb, immI16 me) %{
13046+ effect(DEF dst, USE src, USE shift, USE mb, USE me);
13047+ predicate(false);
13048+
13049+ format %{ "RLWINM $dst, $src, $shift, $mb, $me" %}
13050+ size(4);
13051+ ins_encode %{
13052+ __ rlwinm($dst$$Register, $src$$Register, $shift$$constant, $mb$$constant, $me$$constant);
13053+ %}
13054+ ins_pipe(pipe_class_default);
13055+ %}
13056+
1304413057// Expand nodes for byte_reverse_int.
1304513058instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 n, immI16 b) %{
1304613059 effect(DEF dst, USE src, USE n, USE b);
@@ -13197,34 +13210,22 @@ instruct bytes_reverse_long(iRegLdst dst, iRegLsrc src) %{
1319713210 ins_pipe(pipe_class_default);
1319813211%}
1319913212
13213+ // Need zero extend. Must not use brh only.
1320013214instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
1320113215 match(Set dst (ReverseBytesUS src));
13202- predicate(!UseByteReverseInstructions);
1320313216 ins_cost(2*DEFAULT_COST);
1320413217
1320513218 expand %{
13219+ immI16 imm31 %{ (int) 31 %}
13220+ immI16 imm24 %{ (int) 24 %}
1320613221 immI16 imm16 %{ (int) 16 %}
1320713222 immI16 imm8 %{ (int) 8 %}
1320813223
13209- urShiftI_reg_imm (dst, src, imm8 );
13224+ rlwinm (dst, src, imm24, imm24, imm31 );
1321013225 insrwi(dst, src, imm8, imm16);
1321113226 %}
1321213227%}
1321313228
13214- instruct bytes_reverse_ushort(iRegIdst dst, iRegIsrc src) %{
13215- match(Set dst (ReverseBytesUS src));
13216- predicate(UseByteReverseInstructions);
13217- ins_cost(DEFAULT_COST);
13218- size(4);
13219-
13220- format %{ "BRH $dst, $src" %}
13221-
13222- ins_encode %{
13223- __ brh($dst$$Register, $src$$Register);
13224- %}
13225- ins_pipe(pipe_class_default);
13226- %}
13227-
1322813229instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
1322913230 match(Set dst (ReverseBytesS src));
1323013231 predicate(!UseByteReverseInstructions);
0 commit comments