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, 7 Sep 2021 01:22:50 +0000 (20:22 -0500)
commit546ecb0054af302acf0839c7f3eb78598f8c0672
tree1ac283fa3b5267e1cbf24d90ded162587be5611d
parent58572bbb62c9588c658fd7656ee359d27c306fb2
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.
gcc/config/rs6000/rs6000.md
gcc/testsuite/gcc.target/powerpc/pr97142.c [new file with mode: 0644]