aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2024-11-30 14:58:05 +0100
committerGeorg-Johann Lay <avr@gjlay.de>2024-11-30 15:13:37 +0100
commit214985f6b35ea8038c4e96590b435aaef2919769 (patch)
tree704454a22a31cac35c48e835c275b9c2f8582ce7
parent6bebb3b0f3fa422d248a1c2075da0598a44c7320 (diff)
downloadgcc-214985f6b35ea8038c4e96590b435aaef2919769.zip
gcc-214985f6b35ea8038c4e96590b435aaef2919769.tar.gz
gcc-214985f6b35ea8038c4e96590b435aaef2919769.tar.bz2
AVR: ad target/84211 - Split MOVW into MOVs in try_split_any.
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.
-rw-r--r--gcc/config/avr/avr-passes.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/config/avr/avr-passes.cc b/gcc/config/avr/avr-passes.cc
index 68ebd31..7be5ec2 100644
--- a/gcc/config/avr/avr-passes.cc
+++ b/gcc/config/avr/avr-passes.cc
@@ -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)