]> git.ipfire.org Git - thirdparty/gcc.git/commit
S/390: Fix flogr RTX.
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2018 16:19:54 +0000 (16:19 +0000)
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Nov 2018 16:19:54 +0000 (16:19 +0000)
commit4e16b9d5ab037805d8a889b894b14e7c20505d52
tree844a5c7e059a1d38f8d2473cdc66764f66d73c76
parentbd9b79620d53b8819d06ec26132e825343fbefa0
S/390: Fix flogr RTX.

The flogr instruction uses a 64 bit register pair target operand.  In
the RTX we model this as a write to a TImode register.  Unfortunately
the RTX's being assigned to the two parts of the target operand were
swapped.  This is no problem if in the end the flogr instruction will
be emitted since the instruction still does what the clzdi expander
expects.  However, a problem arises when the RTX is used to optimize
CLZ for a constant input operand.  Even then it matters only if the
expression couldn't be folded on tree level already.

In the testcase this happened thanks to loop unrolling on RTL level.
The iteration variable is used as an argument to the clz
builtin. Due to the loop unrolling it becomes a constant and after
folding the broken RTX leads to a wrong assumption.

gcc/ChangeLog:

2018-11-20  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/s390.md ("clztidi2"): Swap the RTX's written to the
DImode parts of the target operand.

gcc/testsuite/ChangeLog:

2018-11-20  Andreas Krebbel  <krebbel@linux.ibm.com>

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266321 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/flogr-1.c [new file with mode: 0644]