]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport pr 87033 to gcc 7
authorMichael Meissner <meissner@linux.ibm.com>
Fri, 28 Sep 2018 00:32:46 +0000 (00:32 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Fri, 28 Sep 2018 00:32:46 +0000 (00:32 +0000)
From-SVN: r264686

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

index 471a203d29585bdae58776785ed6c8c46a71f802..97544c28c591475308e1806f8e394ea5ca662a09 100644 (file)
@@ -1,3 +1,13 @@
+2018-09-27  Michael Meissner  <meissner@linux.ibm.com>
+
+       Backport from mainline
+       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-09-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Return false
index 4428a1e294421190879c1ee150504346d63cb166..cfa96a4b4714c0f379a457ab656799d724f75b38 100644 (file)
 
 (define_insn "extendsi<mode>2"
   [(set (match_operand:EXTSI 0 "gpc_reg_operand" "=r,r,wl,wu,wj,wK,wH")
-       (sign_extend:EXTSI (match_operand:SI 1 "lwa_operand" "Y,r,Z,Z,r,wK,wH")))]
+       (sign_extend:EXTSI (match_operand:SI 1 "lwa_operand" "YZ,r,Z,Z,r,wK,wH")))]
   ""
   "@
    lwa%U1%X1 %0,%1
index 55bf1c25c9c8b9d8cb46295996f0e1908980c81f..51c37c923f5f780aeaa10c6b49a4533a5a399377 100644 (file)
@@ -1,3 +1,11 @@
+2018-09-27  Michael Meissner  <meissner@linux.ibm.com>
+
+       Backport from mainline
+       2018-08-20  Michael Meissner  <meissner@linux.ibm.com>
+
+       PR target/87033
+       * gcc.target/powerpc/pr87033.c: New test.
+
 2018-09-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/nested-func-11.c: New test.
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}  } } */