-
Handle stack pointer with SUBS/ADDS instructions. · 341fca1b
In general the stack pointer was not handled for many SUBS/ADDS patterns in aarch64.md. Both the "extended register" and "immediate" forms allow the stack pointer to be used as the source register, while no form allows the stack pointer for the destination register. The define_insn patterns generating ADDS/SUBS did not allow the stack pointer for any operand, while the define_peephole2 patterns that generated RTX to be matched by these patterns allowed the stack pointer for any operand. The patterns are fixed by adding the 'k' constraint for the first source operand to all define_insns that generate the ADDS/SUBS "extended register" and "immediate" forms (but not the "shifted register" form). In peephole optimizations, constraint strings are ignored (see "(gccint) C Constraint Interface" info node in the documentation), so the decision to act or not is based solely on the predicate and condition. This patch introduces a new predicate "aarch64_general_reg" to be used in define_peephole2 patterns where only GENERAL_REGS registers are acceptable and uses that predicate in the peepholes that generate patterns for ADDS/SUBS. Full bootstrap and regtest done on aarch64-none-linux-gnu. Regression tests done on aarch64-none-linux-gnu and aarch64-none-elf cross compiler. OK for trunk? gcc/ChangeLog: 2019-02-22 Matthew Malcomson <matthew.malcomson@arm.com> PR target/89324 * config/aarch64/aarch64.md: Use aarch64_general_reg predicate on destination register in peepholes generating patterns for ADDS/SUBS. (add<mode>3_compare0, *addsi3_compare0_uxtw, add<mode>3_compareC, add<mode>3_compareV_imm, add<mode>3_compareV, *adds_<optab><ALLX:mode>_<GPI:mode>, *subs_<optab><ALLX:mode>_<GPI:mode>, *adds_<optab><ALLX:mode>_shift_<GPI:mode>, *subs_<optab><ALLX:mode>_shift_<GPI:mode>, *adds_<optab><mode>_multp2, *subs_<optab><mode>_multp2, *sub<mode>3_compare0, *subsi3_compare0_uxtw, sub<mode>3_compare1): Allow stack pointer for source register. * config/aarch64/predicates.md (aarch64_general_reg): New predicate. gcc/testsuite/ChangeLog: 2019-02-22 Matthew Malcomson <matthew.malcomson@arm.com> PR target/89324 * gcc.dg/rtl/aarch64/subs_adds_sp.c: New test. * gfortran.fortran-torture/compile/pr89324.f90: New test. From-SVN: r269122
Matthew Malcomson committed
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
compile | Loading commit data... | |
execute | Loading commit data... | |
ChangeLog.g95 | Loading commit data... |