aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-06-22 19:27:22 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-06-22 19:27:22 -0700
commit0397ac35755f5edc409010579811e9101f86ab2c (patch)
treebe0cc8f8df5358e5dc66e7b90c6d8921ee0f2dee /gcc
parent2e5a151084e83d504acb5056d57f67cde737335b (diff)
downloadgcc-0397ac35755f5edc409010579811e9101f86ab2c.zip
gcc-0397ac35755f5edc409010579811e9101f86ab2c.tar.gz
gcc-0397ac35755f5edc409010579811e9101f86ab2c.tar.bz2
i386.c (TARGET_STRUCT_VALUE_RTX): New.
* config/i386/i386.c (TARGET_STRUCT_VALUE_RTX): New. (ix86_return_in_memory): Move SSE vector return warning ... (ix86_struct_value_rtx): ... here. New. From-SVN: r83533
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c58
2 files changed, 43 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d53095a..526a8ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2004-06-22 Richard Henderson <rth@redhat.com>
+ * config/i386/i386.c (TARGET_STRUCT_VALUE_RTX): New.
+ (ix86_return_in_memory): Move SSE vector return warning ...
+ (ix86_struct_value_rtx): ... here. New.
+
+2004-06-22 Richard Henderson <rth@redhat.com>
+
* tree.def (VTABLE_REF): Remove.
(OBJ_TYPE_REF): New.
(TRY_CATCH_EXPR, TRY_FINALLY_EXPR): Set type 's'.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 30d0315..fea3298 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -922,6 +922,7 @@ static tree ix86_handle_cdecl_attribute (tree *, tree, tree, int, bool *);
static tree ix86_handle_regparm_attribute (tree *, tree, tree, int, bool *);
static int ix86_value_regno (enum machine_mode);
static bool contains_128bit_aligned_vector_p (tree);
+static rtx ix86_struct_value_rtx (tree, int);
static bool ix86_ms_bitfield_layout_p (tree);
static tree ix86_handle_struct_attribute (tree *, tree, tree, int, bool *);
static int extended_reg_mentioned_1 (rtx *, void *);
@@ -1068,7 +1069,8 @@ static void init_ext_80387_constants (void);
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
-
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX ix86_struct_value_rtx
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS ix86_setup_incoming_varargs
@@ -2900,27 +2902,9 @@ ix86_return_in_memory (tree type)
if (size == 8)
return 1;
- /* SSE values are returned in XMM0. */
- /* ??? Except when it doesn't exist? We have a choice of
- either (1) being abi incompatible with a -march switch,
- or (2) generating an error here. Given no good solution,
- I think the safest thing is one warning. The user won't
- be able to use -Werror, but.... */
+ /* SSE values are returned in XMM0, except when it doesn't exist. */
if (size == 16)
- {
- static bool warned;
-
- if (TARGET_SSE)
- return 0;
-
- if (!warned)
- {
- warned = true;
- warning ("SSE vector return without SSE enabled "
- "changes the ABI");
- }
- return 1;
- }
+ return (TARGET_SSE ? 0 : 1);
}
if (mode == XFmode)
@@ -2931,6 +2915,38 @@ ix86_return_in_memory (tree type)
return 0;
}
+/* When returning SSE vector types, we have a choice of either
+ (1) being abi incompatible with a -march switch, or
+ (2) generating an error.
+ Given no good solution, I think the safest thing is one warning.
+ The user won't be able to use -Werror, but....
+
+ Choose the STRUCT_VALUE_RTX hook because that's (at present) only
+ called in response to actually generating a caller or callee that
+ uses such a type. As opposed to RETURN_IN_MEMORY, which is called
+ via aggregate_value_p for general type probing from tree-ssa. */
+
+static rtx
+ix86_struct_value_rtx (tree type, int incoming ATTRIBUTE_UNUSED)
+{
+ static bool warned;
+
+ if (!TARGET_SSE && type && !warned)
+ {
+ /* Look at the return type of the function, not the function type. */
+ enum machine_mode mode = TYPE_MODE (TREE_TYPE (type));
+
+ if (mode == TImode
+ || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16))
+ {
+ warned = true;
+ warning ("SSE vector return without SSE enabled changes the ABI");
+ }
+ }
+
+ return NULL;
+}
+
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
rtx