1
# DP: ppc64el, fix ELFv2 homogeneous float aggregate ABI bug
3
Subject: [PATCH, rs6000, 4.8/4.9] Fix ELFv2 homogeneous float aggregate ABI bug
7
this is the variant intended for the 4.8/4.9 branches of the patch:
8
https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00994.html
10
As discussed, it does *not* actually change ABI, but only warn when
11
encountering a situation where the ABI will change in a future GCC.
12
(Avoiding the specific term "GCC 4.10" here since I'm not certain
13
whether the next GCC release will in fact be called that ...)
15
Tested on powerpc64-linux and powerpc64le-linux; also verified using
16
the ABI compat suite (against an unpatched GCC) that this patch does
19
OK for 4.8/4.9 once the mainline patch is in?
27
* config/rs6000/rs6000.c (rs6000_function_arg): If a float argument
28
does not fit fully into floating-point registers, and there is still
29
space in the register parameter area, issue -Wpsabi note that the ABI
30
will change in a future GCC release.
32
gcc/testsuite/ChangeLog:
34
* gcc.target/powerpc/ppc64-abi-warn-1.c: New test.
37
--- a/src/gcc/config/rs6000/rs6000.c
38
+++ b/src/gcc/config/rs6000/rs6000.c
39
@@ -10225,6 +10225,7 @@ rs6000_function_arg (cumulative_args_t c
42
unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
45
/* Do we also need to pass this argument in the parameter
47
@@ -10253,6 +10254,37 @@ rs6000_function_arg (cumulative_args_t c
48
rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
51
+ /* If there were not enough FPRs to hold the argument, the rest
52
+ usually goes into memory. However, if the current position
53
+ is still within the register parameter area, a portion may
54
+ actually have to go into GPRs.
56
+ Note that it may happen that the portion of the argument
57
+ passed in the first "half" of the first GPR was already
58
+ passed in the last FPR as well.
60
+ For unnamed arguments, we already set up GPRs to cover the
61
+ whole argument in rs6000_psave_function_arg, so there is
62
+ nothing further to do at this point.
64
+ GCC 4.8/4.9 Note: This was implemented incorrectly in earlier
65
+ GCC releases. To avoid any ABI change on the release branch,
66
+ we retain that original implementation here, but warn if we
67
+ encounter a case where the ABI will change in the future. */
68
+ fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8);
69
+ if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG
70
+ && cum->nargs_prototype > 0)
73
+ if (!warned && warn_psabi)
76
+ inform (input_location,
77
+ "the ABI of passing homogeneous float aggregates"
78
+ " will change in a future GCC release");
82
return rs6000_finish_function_arg (mode, rvec, k);
84
else if (align_words < GP_ARG_NUM_REG)
86
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
88
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
89
+/* { dg-options "-mabi=elfv2" } */
96
+void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */