]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: Expand fmod and remainder when built with fast-math [PR97142]
authorXionghu Luo <luoxhu@linux.ibm.com>
Tue, 7 Sep 2021 01:22:50 +0000 (20:22 -0500)
committerXionghu Luo <luoxhu@linux.ibm.com>
Tue, 14 Sep 2021 05:32:56 +0000 (00:32 -0500)
commita87d7fbef55f72781905bffb298aab698fe6ed40
tree4a8fc7ca33fc1faeb30d54268a8ab63d27d48eb8
parent6dd2650f96c0b11f1c21a0e97bfcd7288c002f01
rs6000: Expand fmod and remainder when built with fast-math [PR97142]

fmod/fmodf and remainder/remainderf could be expanded instead of library
call when fast-math build, which is much faster.

fmodf:
     fdivs   f0,f1,f2
     friz    f0,f0
     fnmsubs f1,f2,f0,f1

remainderf:
     fdivs   f0,f1,f2
     frin    f0,f0
     fnmsubs f1,f2,f0,f1

SPEC2017 Ofast P8LE: 511.povray_r +1.14%,  526.blender_r +1.72%

gcc/ChangeLog:

2021-09-07  Xionghu Luo  <luoxhu@linux.ibm.com>

PR target/97142
* config/rs6000/rs6000.md (fmod<mode>3): New define_expand.
(remainder<mode>3): Likewise.

gcc/testsuite/ChangeLog:

2021-09-07  Xionghu Luo  <luoxhu@linux.ibm.com>

PR target/97142
* gcc.target/powerpc/pr97142.c: New test.

(cherry-picked from 546ecb0054af302acf0839c7f3eb78598f8c0672)
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/pr97142.c [new file with mode: 0644]