aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.cc
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2023-04-20 20:59:42 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2023-05-06 01:58:16 +0200
commitfe50e419086f5b781b6fe8242741e6213b788337 (patch)
treee43b6e933fceededd394bbaa0d8c6ee9d130f040 /gcc/combine.cc
parent0a5e8d492a7efc739110289bf97ef4c9fe0674f4 (diff)
downloadgcc-fe50e419086f5b781b6fe8242741e6213b788337.zip
gcc-fe50e419086f5b781b6fe8242741e6213b788337.tar.gz
gcc-fe50e419086f5b781b6fe8242741e6213b788337.tar.bz2
CRIS: peephole2 a move of constant followed by and of same register
While moves of constants into registers are separately optimizable, a combination of a move with a subsequent "and" is slightly preferable even if the move can be generated with the same number (and timing) of insns, as moves of "just" registers are eliminated now and then in different passes, loosely speaking. This movandsplit1 pattern feeds into the opsplit1/AND peephole2, with matching occurrences observed in the floating point functions in libgcc. Also, a test-case to fit. Coremark improvements are unimpressive: less than 0.0003% speed, 0.1% size. But that was pre-LRA; after the switch to LRA this peephole2 doesn't match anymore (for any of coremark, local tests, libgcc and newlib libc) and the test-case passes with and without the patch. Still, there's no apparent reason why LRA prefers "move R1,R2" "and I,R2" to "move I,R1" "and R1,R2", or why that wouldn't "randomly" change (also seen with other operations than "and"). Thus committed. gcc: * config/cris/cris.md (movandsplit1): New define_peephole2. gcc/testsuite: * gcc.target/cris/peep2-movandsplit1.c: New test.
Diffstat (limited to 'gcc/combine.cc')
0 files changed, 0 insertions, 0 deletions