@@ -13072,6 +13072,19 @@ instruct countTrailingZerosL_cnttzd(iRegIdst dst, iRegLsrc src) %{
1307213072 ins_pipe(pipe_class_default);
1307313073%}
1307413074
13075+ // Expand nodes for byte_reverse_int/ushort/short.
13076+ instruct rlwinm(iRegIdst dst, iRegIsrc src, immI16 shift, immI16 mb, immI16 me) %{
13077+ effect(DEF dst, USE src, USE shift, USE mb, USE me);
13078+ predicate(false);
13079+
13080+ format %{ "RLWINM $dst, $src, $shift, $mb, $me" %}
13081+ size(4);
13082+ ins_encode %{
13083+ __ rlwinm($dst$$Register, $src$$Register, $shift$$constant, $mb$$constant, $me$$constant);
13084+ %}
13085+ ins_pipe(pipe_class_default);
13086+ %}
13087+
1307513088// Expand nodes for byte_reverse_int.
1307613089instruct insrwi_a(iRegIdst dst, iRegIsrc src, immI16 n, immI16 b) %{
1307713090 effect(DEF dst, USE src, USE n, USE b);
@@ -13228,34 +13241,22 @@ instruct bytes_reverse_long(iRegLdst dst, iRegLsrc src) %{
1322813241 ins_pipe(pipe_class_default);
1322913242%}
1323013243
13244+ // Need zero extend. Must not use brh only.
1323113245instruct bytes_reverse_ushort_Ex(iRegIdst dst, iRegIsrc src) %{
1323213246 match(Set dst (ReverseBytesUS src));
13233- predicate(!UseByteReverseInstructions);
1323413247 ins_cost(2*DEFAULT_COST);
1323513248
1323613249 expand %{
13250+ immI16 imm31 %{ (int) 31 %}
13251+ immI16 imm24 %{ (int) 24 %}
1323713252 immI16 imm16 %{ (int) 16 %}
1323813253 immI16 imm8 %{ (int) 8 %}
1323913254
13240- urShiftI_reg_imm (dst, src, imm8 );
13255+ rlwinm (dst, src, imm24, imm24, imm31 );
1324113256 insrwi(dst, src, imm8, imm16);
1324213257 %}
1324313258%}
1324413259
13245- instruct bytes_reverse_ushort(iRegIdst dst, iRegIsrc src) %{
13246- match(Set dst (ReverseBytesUS src));
13247- predicate(UseByteReverseInstructions);
13248- ins_cost(DEFAULT_COST);
13249- size(4);
13250-
13251- format %{ "BRH $dst, $src" %}
13252-
13253- ins_encode %{
13254- __ brh($dst$$Register, $src$$Register);
13255- %}
13256- ins_pipe(pipe_class_default);
13257- %}
13258-
1325913260instruct bytes_reverse_short_Ex(iRegIdst dst, iRegIsrc src) %{
1326013261 match(Set dst (ReverseBytesS src));
1326113262 predicate(!UseByteReverseInstructions);
0 commit comments