re PR target/87033 (The compiler does not generate the LWAX instruction)
authorMichael Meissner <meissner@linux.ibm.com>
Mon, 20 Aug 2018 23:46:37 +0000 (23:46 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Mon, 20 Aug 2018 23:46:37 +0000 (23:46 +0000)
[gcc]
2018-08-20  Michael Meissner  <meissner@linux.ibm.com>

PR target/87033
* config/rs6000/rs6000.md (extendsi<mode>2): Change constraints
from 'Y' to 'YZ' to enable the LWAX instruction to be generated
for indexed loads.

[gcc/testsuite]
2018-08-20  Michael Meissner  <meissner@linux.ibm.com>

PR target/87033
* gcc.target/powerpc/pr87033.c: New test.

From-SVN: r263678

gcc/ChangeLog
gcc/config/rs6000/rs6000.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr87033.c [new file with mode: 0644]

index ca49dba4437b7f430bbc863fb9b38a745784b9a4..cb9f5528e4b6db85722b2626611150ac3977ed9f 100644 (file)
@@ -1,3 +1,10 @@
+2018-08-20  Michael Meissner  <meissner@linux.ibm.com>
+
+       PR target/87033
+       * config/rs6000/rs6000.md (extendsi<mode>2): Change constraints
+       from 'Y' to 'YZ' to enable the LWAX instruction to be generated
+       for indexed loads.
+
 2018-08-20  Nathan Sidwell  <nathan@acm.org>
            Jeff Law <law@redhat.com>
 
index d34fcf0966bdeb6517facb8bebcc3a852e1eb355..49e209072a61798aba034dab9cbb351809950a45 100644 (file)
                     "=r, r,   wl,    wu,    wj,    wK,     wH,    wr")
 
        (sign_extend:EXTSI (match_operand:SI 1 "lwa_operand"
-                    "Y r,   Z,     Z,     r,     wK,     wH,    ?wIwH")))]
+                    "YZ, r,   Z,     Z,     r,     wK,     wH,    ?wIwH")))]
   ""
   "@
    lwa%U1%X1 %0,%1
index 3708a5c4438f5097ce41e68df53452fd2f0e0808..af8615607fbebdc0f69605d37677380e36740835 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-20  Michael Meissner  <meissner@linux.ibm.com>
+
+       PR target/87033
+       * gcc.target/powerpc/pr87033.c: New test.
+
 2018-08-20  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/87034
diff --git a/gcc/testsuite/gcc.target/powerpc/pr87033.c b/gcc/testsuite/gcc.target/powerpc/pr87033.c
new file mode 100644 (file)
index 0000000..9d62ce7
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-options "-O2" } */
+
+/* Insure that a LWAX is generated instead of ADD + LWA.  LP64 is needed
+   because the LWA and LWAX instructions are only available in 64-bit mode.  */
+long func (int *p, unsigned long n)
+{
+  return p[n];
+}
+
+/* { dg-final { scan-assembler     {\mlwax\M} } } */
+/* { dg-final { scan-assembler-not {\mlwa\M}  } } */