re PR target/71493 (accidental ABI change for structure return on PowerPC)
authorMichael Meissner <meissner@linux.vnet.ibm.com>
Tue, 19 Jul 2016 03:31:48 +0000 (03:31 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Tue, 19 Jul 2016 03:31:48 +0000 (03:31 +0000)
[gcc]
2016-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/71493
* config/rs6000/rs6000.c (rs6000_function_value): Fix
unintentional System V.4 structure return breakage for structures
with a single floating point element.

[gcc/testsuite]
2016-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/71493
* gcc.target/powerpc/pr71493-1.c: New test.
* gcc.target/powerpc/pr71493-2.c: Likewise.

From-SVN: r238454

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr71493-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr71493-2.c [new file with mode: 0644]

index 3f24fab978d2faa2ef42d0a3c6f7680237254264..5d7c09912a4eacedbd54d86fb6c6db652ccfce76 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/71493
+       * config/rs6000/rs6000.c (rs6000_function_value): Fix
+       unintentional System V.4 structure return breakage for structures
+       with a single floating point element.
+
 2016-07-18  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        PR tree-optimization/71734
index 63655b1d267a86bd0facfec8dfc250bd30be89af..6fe94d5084c07d79bbad1d2d6bf5b8ac1ed87d67 100644 (file)
@@ -35467,7 +35467,8 @@ rs6000_function_value (const_tree valtype,
   if (DECIMAL_FLOAT_MODE_P (mode) && TARGET_HARD_FLOAT && TARGET_FPRS)
     /* _Decimal128 must use an even/odd register pair.  */
     regno = (mode == TDmode) ? FP_ARG_RETURN + 1 : FP_ARG_RETURN;
-  else if (SCALAR_FLOAT_MODE_NOT_VECTOR_P (mode) && TARGET_HARD_FLOAT && TARGET_FPRS
+  else if (SCALAR_FLOAT_TYPE_P (valtype) && TARGET_HARD_FLOAT && TARGET_FPRS
+          && !FLOAT128_VECTOR_P (mode)
           && ((TARGET_SINGLE_FLOAT && (mode == SFmode)) || TARGET_DOUBLE_FLOAT))
     regno = FP_ARG_RETURN;
   else if (TREE_CODE (valtype) == COMPLEX_TYPE
index 86655a043d7bb412ea2ecee031b201a0af9e268c..2dd59609bdd8abea74a3c4181d67b49c5a91b948 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/71493
+       * gcc.target/powerpc/pr71493-1.c: New test.
+       * gcc.target/powerpc/pr71493-2.c: Likewise.
+
 2016-07-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/71835
diff --git a/gcc/testsuite/gcc.target/powerpc/pr71493-1.c b/gcc/testsuite/gcc.target/powerpc/pr71493-1.c
new file mode 100644 (file)
index 0000000..9ec9da0
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { powerpc*-*-linux* && ilp32 } } } */
+/* { dg-options "-O2 -msvr4-struct-return" } */
+
+struct S1 { float f; };
+
+struct S1 foo1 (void)
+{
+  struct S1 s = { 1.0f };
+  return s;
+}
+
+/* { dg-final { scan-assembler     "lwz" } } */
+/* { dg-final { scan-assembler-not "lfs" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr71493-2.c b/gcc/testsuite/gcc.target/powerpc/pr71493-2.c
new file mode 100644 (file)
index 0000000..e9184a6
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { powerpc*-*-linux* && ilp32 } } } */
+/* { dg-options "-O2 -msvr4-struct-return" } */
+
+struct S2 { double d; };
+
+struct S2 foo2 (void)
+{
+  struct S2 s = { 1.0 };
+  return s;
+}
+
+/* { dg-final { scan-assembler     "lwz" } } */
+/* { dg-final { scan-assembler-not "lfd" } } */