]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/config/s390/s390.md
S/390: Merge movdi_larl into movdi_64
authorIlya Leoshkevich <iii@linux.ibm.com>
Thu, 25 Oct 2018 14:23:31 +0000 (14:23 +0000)
committerIlya Leoshkevich <iii@gcc.gnu.org>
Thu, 25 Oct 2018 14:23:31 +0000 (14:23 +0000)
commitb6f517556c28d471237718e472f0c49fef99804d
treee6d3ba00618a1f516668784acf1579b0178d2e1b
parent4dd7c0dcd87c86aad3d2cd45a08798eb445a9d3c
S/390: Merge movdi_larl into movdi_64

Consider the following RTL:

(insn (set (mem/f/c:DI (reg/f:DI 60))
           (const:DI (plus:DI (symbol_ref:DI ("*.LANCHOR0"))
                              (const_int 8)))))

generated by cse2 pass.  It is matched to movdi_64, resulting in
the following inefficient code:

larl %r5,.L6 # Load literal pool@
lg %r1,.L7-.L6(%r5) # Load .LANCHOR0+8
stgrl %r1,.LANCHOR0
br %r14

Matching it to movdi_larl improves the code, eliminating one
instruction and the literal pool entry:

larl %r1,.LANCHOR0+8
stgrl %r1,.LANCHOR0
br %r14

Taking it one step further, there is no reason to keep movdi_64 and
movdi_larl separate, since this could potentially improve code in other
ways by giving lra one more alternative to choose from.

gcc/ChangeLog:

2018-10-25  Ilya Leoshkevich  <iii@linux.ibm.com>

* config/s390/constraints.md (ZL): New constraint.
* config/s390/s390.c (legitimate_pic_operand_p): Accept LARL
operands.
* config/s390/s390.md (movdi_larl): Remove.
(movdi_64): Add the LARL alternative.

gcc/testsuite/ChangeLog:

2018-10-25  Ilya Leoshkevich  <iii@linux.ibm.com>

* gcc.target/s390/global-array-almost-huge-element.c: New test.
* gcc.target/s390/global-array-almost-negative-huge-element.c: New test.
* gcc.target/s390/global-array-element-pic.c: New test.
* gcc.target/s390/global-array-even-element.c: New test.
* gcc.target/s390/global-array-huge-element.c: New test.
* gcc.target/s390/global-array-negative-huge-element.c: New test.
* gcc.target/s390/global-array-odd-element.c: New test.

From-SVN: r265490
12 files changed:
gcc/ChangeLog
gcc/config/s390/constraints.md
gcc/config/s390/s390.c
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/global-array-almost-huge-element.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-almost-negative-huge-element.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-element-pic.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-even-element.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-huge-element.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-negative-huge-element.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/global-array-odd-element.c [new file with mode: 0644]