Don't force target of modulo into a distinct register.
authorPat Haugen <pthaugen@linux.ibm.com>
Thu, 23 Mar 2023 19:08:00 +0000 (14:08 -0500)
committerPat Haugen <pthaugen@linux.ibm.com>
Thu, 23 Mar 2023 19:08:00 +0000 (14:08 -0500)
commitf58cbbb7c90d8cfea87dc4490b575a368e1e2c82
tree86f180c1449a40adf1a978716c5702bbf027adbd
parent80ed2a6471a39dd95192a334789fd63d5efd2e8a
Don't force target of modulo into a distinct register.

The define_insns for the modulo operation currently force the target register
to a distinct reg in preparation for a possible future peephole combining
div/mod. But this can lead to cases of a needless copy being inserted. Fixed
with the following patch.

gcc/
* config/rs6000/rs6000.md (*mod<mode>3, umod<mode>3): Add
non-earlyclobber alternative.

gcc/testsuite/
* gcc.target/powerpc/mod-no_copy.c: New.
* gcc.target/powerpc/mod-peephole.c: New.
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/mod-no_copy.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/mod-peephole.c [new file with mode: 0644]