]> 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 19:07:45 +0000 (14:07 -0500)
commit65d89dd9ae151a19fd403e1fbcb1b37b942d2932
treec5cdf6f7a6b9b711fe77dea08efa2a9c62505446
parent9f6f689409a4f5edf3c56071c8d6abeec7a557c4
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