]> git.ipfire.org Git - thirdparty/gcc.git/commit
s390: Optimize fmin/fmax.
authorJuergen Christ <jchrist@linux.ibm.com>
Fri, 20 Jun 2025 14:08:34 +0000 (16:08 +0200)
committerJuergen Christ <jchrist@linux.ibm.com>
Mon, 7 Jul 2025 17:05:50 +0000 (19:05 +0200)
commitc476f554e3f52086181d5c85701db34f6f390e3c
treec3cfe1ebcc491a673b9562a4246f3e19c01b7f12
parent4b9f760c511a4ef3a390dd6cfab80bada57c2535
s390: Optimize fmin/fmax.

On VXE targets, we can directly use the fp min/max instruction instead of
calling into libm for fmin/fmax etc.

Provide fmin/fmax versions also for vectors even though it cannot be
called directly.  This will be exploited with a follow-up patch when
reductions are introduced.

gcc/ChangeLog:

* config/s390/s390.md: Update UNSPECs
* config/s390/vector.md (fmax<mode>3): New expander.
(fmin<mode>3): New expander.
* config/s390/vx-builtins.md (*fmin<mode>): New insn.
(vfmin<mode>): Redefined to use new insn.
(*fmax<mode>): New insn.
(vfmax<mode>): Redefined to use new insn.

gcc/testsuite/ChangeLog:

* gcc.target/s390/fminmax-1.c: New test.
* gcc.target/s390/fminmax-2.c: New test.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
gcc/config/s390/s390.md
gcc/config/s390/vector.md
gcc/config/s390/vx-builtins.md
gcc/testsuite/gcc.target/s390/fminmax-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/fminmax-2.c [new file with mode: 0644]