]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: ad target/84211 - Split MOVW into MOVs in try_split_any.
authorGeorg-Johann Lay <avr@gjlay.de>
Sat, 30 Nov 2024 13:58:05 +0000 (14:58 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Sat, 30 Nov 2024 14:13:37 +0000 (15:13 +0100)
When splitting multi-byte REG-REG moves in try_split_any(),
it's not clear whether propagating constants will turn
out as profitable.  When MOVW is available, split into
REG-REG moves instead of a possible REG-CONST.
gcc/
PR target/84211
* config/avr/avr-passes.cc (try_split_any) [SET, MOVW]: Prefer
reg=reg move over reg=const when splitting a reg=reg insn.

gcc/config/avr/avr-passes.cc

index 68ebd31390ec86de80710523fbe276566f871654..7be5ec25fbcec5ea988f2d7ee2e548371651a08e 100644 (file)
@@ -2912,6 +2912,14 @@ optimize_data_t::try_split_any (bbinfo_t *)
              xsrc = gen_rtx_REG (HImode, r16);
              i += step;
            }
+         // ...or a reg-reg move from a multi-byte move...
+         else if (r_src
+                  // Prefer a reg-reg move over a (potential) load
+                  // of a constant, because the subsequent RTL
+                  // peephole pass may combine it to a MOVW again.
+                  && AVR_HAVE_MOVW
+                  && REG_P (curr.ii.m_src))
+           xsrc = gen_rtx_REG (QImode, r_src);
          // ...or a cheap constant...
          else if (val8 >= 0
                   && AVRasm::constant_cost (SET, r_dest, val8) <= 1)