]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000.c (rs6000_function_arg): If a float argument does not fit fully into floating...
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 24 Jul 2014 17:30:52 +0000 (17:30 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Thu, 24 Jul 2014 17:30:52 +0000 (17:30 +0000)
gcc/

* config/rs6000/rs6000.c (rs6000_function_arg): If a float argument
does not fit fully into floating-point registers, and there is still
space in the register parameter area, issue -Wpsabi note that the ABI
will change in a future GCC release.

gcc/testsuite/

* gcc.target/powerpc/ppc64-abi-warn-1.c: New test.

From-SVN: r213023

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

index 51a4e7cc5b89855b2e13df579d31488ef823c80c..f03a8192a0e9d870033e80fef1cdac604f3f7a19 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-23  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument
+       does not fit fully into floating-point registers, and there is still
+       space in the register parameter area, issue -Wpsabi note that the ABI
+       will change in a future GCC release.
+
 2014-07-23  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        * config/arm/t-rtems-eabi: Add
index 3c1ff4d2563fb171a71c33b5f81de9c869df259c..7bdbdccda109a037dd4649194daa066a48ef209b 100644 (file)
@@ -10245,6 +10245,7 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
          rtx r, off;
          int i, k = 0;
          unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
+         int fpr_words;
 
          /* Do we also need to pass this argument in the parameter
             save area?  */
@@ -10273,6 +10274,37 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
              rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
            }
 
+         /* If there were not enough FPRs to hold the argument, the rest
+            usually goes into memory.  However, if the current position
+            is still within the register parameter area, a portion may
+            actually have to go into GPRs.
+
+            Note that it may happen that the portion of the argument
+            passed in the first "half" of the first GPR was already
+            passed in the last FPR as well.
+
+            For unnamed arguments, we already set up GPRs to cover the
+            whole argument in rs6000_psave_function_arg, so there is
+            nothing further to do at this point.
+
+            GCC 4.8/4.9 Note: This was implemented incorrectly in earlier
+            GCC releases.  To avoid any ABI change on the release branch,
+            we retain that original implementation here, but warn if we
+            encounter a case where the ABI will change in the future.  */
+         fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8);
+         if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG
+             && cum->nargs_prototype > 0)
+            {
+             static bool warned;
+             if (!warned && warn_psabi)
+               {
+                 warned = true;
+                 inform (input_location,
+                         "the ABI of passing homogeneous float aggregates"
+                         " will change in a future GCC release");
+               }
+           }
+
          return rs6000_finish_function_arg (mode, rvec, k);
        }
       else if (align_words < GP_ARG_NUM_REG)
index 394ca7ae44757751884451b99400ab39e2990f56..0289f57bf9a13904291f8def7d5d01a0f507e5a9 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       Backport from mainline:
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * gcc.target/powerpc/ppc64-abi-warn-1.c: New test.
+
 2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
new file mode 100644 (file)
index 0000000..6e0d548
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-options "-mabi=elfv2" } */
+
+struct f8
+  {
+    float x[8];
+  };
+
+void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */
+{
+}
+