IBM Z: Try to make use of load-and-test instructions
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Fri, 18 Sep 2020 07:10:19 +0000 (09:10 +0200)
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Tue, 22 Sep 2020 11:55:42 +0000 (13:55 +0200)
commit1a84651d164e9ebf080e0b64f0ad300eaae46297
treeadca2864fc047adf2fc0d9d8111b733c10db6c62
parentc0e9cee285e47f806227b22812b15ffea677d578
IBM Z: Try to make use of load-and-test instructions

This patch enables a peephole2 optimization which transforms a load of
constant zero into a temporary register which is then finally used to
compare against a floating-point register of interest into a single load
and test instruction.  However, the optimization is only applied if both
registers are dead afterwards and if we test for (in)equality only.
This is relaxed in case of fast math.

This is a follow up to PR88856.

gcc/ChangeLog:

* config/s390/s390.md ("*cmp<mode>_ccs_0", "*cmp<mode>_ccz_0",
"*cmp<mode>_ccs_0_fastmath"): Basically change "*cmp<mode>_ccs_0" into
"*cmp<mode>_ccz_0" and for fast math add "*cmp<mode>_ccs_0_fastmath".

gcc/testsuite/ChangeLog:

* gcc.target/s390/load-and-test-fp-1.c: Change test to include all
possible combinations of dead/live registers and comparisons (equality,
relational).
* gcc.target/s390/load-and-test-fp-2.c: Same as load-and-test-fp-1.c
but for fast math.
* gcc.target/s390/load-and-test-fp.h: New test included by
load-and-test-fp-{1,2}.c.
gcc/config/s390/s390.md
gcc/testsuite/gcc.target/s390/load-and-test-fp-1.c
gcc/testsuite/gcc.target/s390/load-and-test-fp-2.c
gcc/testsuite/gcc.target/s390/load-and-test-fp.h [new file with mode: 0644]