]> gcc.gnu.org Git - gcc.git/commit
AVR: target/90616 - Improve adding constants that are 0 mod 256.
authorGeorg-Johann Lay <avr@gjlay.de>
Thu, 4 Jul 2024 10:08:34 +0000 (12:08 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Wed, 17 Jul 2024 15:37:10 +0000 (17:37 +0200)
commite21fef7da92ef36af1e1b020ae5f35ef4f3c3fce
treebbfff4188064bf584d89d6ef0d6ebd1497202827
parent5104fe4c7808a66ed3041a8da8e4720585cc8a1f
AVR: target/90616 - Improve adding constants that are 0 mod 256.

This patch introduces a new insn that works as an insn combine
pattern for

   (plus:HI (zero_extend:HI (reg:QI))
            (const_0mod256_operannd:HI))

which requires at most 2 instructions.  When the input register operand
is already in HImode, the addhi3 printer only adds the hi8 part when
it sees a SYMBOL_REF or CONST aligned to at least 256 bytes.
(The CONST_INT case was already handled).

gcc/
PR target/90616
* config/avr/predicates.md (const_0mod256_operand): New predicate.
* config/avr/constraints.md (Cp8): New constraint.
* config/avr/avr.md (*aligned_add_symbol): New insn.
* config/avr/avr.cc (avr_out_plus_symbol) [HImode]:
When op2 is a multiple of 256, there is no need to add / subtract
the lo8 part.
(avr_rtx_costs_1) [PLUS && HImode]: Return expected costs for
new insn *aligned_add_symbol as it applies.
gcc/config/avr/avr.cc
gcc/config/avr/avr.md
gcc/config/avr/constraints.md
gcc/config/avr/predicates.md
This page took 0.055578 seconds and 5 git commands to generate.