From: Richard Henderson Date: Wed, 23 Jun 2004 02:27:22 +0000 (-0700) Subject: i386.c (TARGET_STRUCT_VALUE_RTX): New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0397ac35755f5edc409010579811e9101f86ab2c;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d53095a9c71..526a8ec0030 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-06-22 Richard Henderson + + * 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 * tree.def (VTABLE_REF): Remove. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 30d031507e2..fea329863fb 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