]> git.ipfire.org Git - thirdparty/gcc.git/commit
Disable generation of scalar modulo instructions.
authorPat Haugen <pthaugen@linux.ibm.com>
Tue, 19 Sep 2023 18:19:59 +0000 (13:19 -0500)
committerPat Haugen <pthaugen@linux.ibm.com>
Mon, 2 Oct 2023 18:17:08 +0000 (13:17 -0500)
commit3ac5ed3719942b8c98e149328603033ce5c61103
treeb839ffa1e2293fdb83c7c79b811928080cec5aa4
parent80ee04d8df2fedfe3493e4e0db974f600a602b04
Disable generation of scalar modulo instructions.

It was recently discovered that the scalar modulo instructions can suffer
noticeable performance issues for certain input values. This patch disables
their generation since the equivalent div/mul/sub sequence does not suffer
the same problem.

gcc/
* config/rs6000/rs6000.cc (rs6000_rtx_costs): Check whether the
modulo instruction is disabled.
* config/rs6000/rs6000.h (RS6000_DISABLE_SCALAR_MODULO): New.
* config/rs6000/rs6000.md (mod<mode>3, *mod<mode>3): Check it.
(define_expand umod<mode>3): New.
(define_insn umod<mode>3): Rename to *umod<mode>3 and check if the modulo
instruction is disabled.
(umodti3, modti3): Check if the modulo instruction is disabled.

gcc/testsuite/
* gcc.target/powerpc/clone1.c: Add xfails.
* gcc.target/powerpc/clone3.c: Likewise.
* gcc.target/powerpc/mod-1.c: Update scan strings and add xfails.
* gcc.target/powerpc/mod-2.c: Likewise.
* gcc.target/powerpc/p10-vdivq-vmodq.c: Add xfails.

(cherry picked from commit 58ab38213b979811d314f68e3f455c28a1d44140)
gcc/config/rs6000/rs6000.cc
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/clone1.c
gcc/testsuite/gcc.target/powerpc/clone3.c
gcc/testsuite/gcc.target/powerpc/mod-1.c
gcc/testsuite/gcc.target/powerpc/mod-2.c
gcc/testsuite/gcc.target/powerpc/p10-vdivq-vmodq.c