* builtins.c (std_expand_builtin_va_arg): Align operand when needed.
* i386.c (init_cumulative_args): Set warn_sse; fix handling of variadic
functions accepting SSE arguments
(function_arg): Warn only when asked to warn.
* i386.h (ix86_args): Add warn_sse/warn_mmx fiels.
From-SVN: r75892
+2004-01-15 Jan Hubicka <jh@suse.cz>
+
+ * builtins.c (std_expand_builtin_va_arg): Align operand when needed.
+ * i386.c (init_cumulative_args): Set warn_sse; fix handling of variadic
+ functions accepting SSE arguments
+ (function_arg): Warn only when asked to warn.
+ * i386.h (ix86_args): Add warn_sse/warn_mmx fiels.
+
2004-01-14 Joseph S. Myers <jsm@polyomino.org.uk>
* c-parse.in (stmts_and_decls): Make label at end of compound
tree align, alignm1;
tree rounded_size;
rtx addr;
+ HOST_WIDE_INT boundary;
/* Compute the rounded size of the type. */
align = size_int (PARM_BOUNDARY / BITS_PER_UNIT);
alignm1 = size_int (PARM_BOUNDARY / BITS_PER_UNIT - 1);
+ boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type);
+
+ /* va_list pointer is aligned to PARM_BOUNDARY. If argument actually
+ requires greater alignment, we must perform dynamic alignment. */
+
+ if (boundary > PARM_BOUNDARY)
+ {
+ if (!PAD_VARARGS_DOWN)
+ {
+ t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
+ build (PLUS_EXPR, TREE_TYPE (valist), valist,
+ build_int_2 (boundary / BITS_PER_UNIT - 1, 0)));
+ TREE_SIDE_EFFECTS (t) = 1;
+ expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
+ }
+ t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
+ build (BIT_AND_EXPR, TREE_TYPE (valist), valist,
+ build_int_2 (~(boundary / BITS_PER_UNIT - 1), -1)));
+ TREE_SIDE_EFFECTS (t) = 1;
+ expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
+ }
if (type == error_mark_node
|| (type_size = TYPE_SIZE_UNIT (TYPE_MAIN_VARIANT (type))) == NULL
|| TREE_OVERFLOW (type_size))
cum->nregs = ix86_regparm;
cum->sse_nregs = SSE_REGPARM_MAX;
cum->mmx_nregs = MMX_REGPARM_MAX;
+ cum->warn_sse = true;
+ cum->warn_mmx = true;
cum->maybe_vaarg = false;
/* Use ecx and edx registers if function has fastcall attribute */
are no variable arguments. If there are variable arguments, then
we won't pass anything in registers */
- if (cum->nregs)
+ if (cum->nregs || !TARGET_MMX || !TARGET_SSE)
{
for (param = (fntype) ? TYPE_ARG_TYPES (fntype) : 0;
param != 0; param = next_param)
if (!TARGET_64BIT)
{
cum->nregs = 0;
+ cum->sse_nregs = 0;
+ cum->mmx_nregs = 0;
+ cum->warn_sse = 0;
+ cum->warn_mmx = 0;
cum->fastcall = 0;
}
cum->maybe_vaarg = true;
case V2DFmode:
if (!type || !AGGREGATE_TYPE_P (type))
{
- if (!TARGET_SSE && !warnedmmx)
+ if (!TARGET_SSE && !warnedmmx && cum->warn_sse)
{
warnedsse = true;
warning ("SSE vector argument without SSE enabled "
case V2SFmode:
if (!type || !AGGREGATE_TYPE_P (type))
{
- if (!TARGET_MMX && !warnedmmx)
+ if (!TARGET_MMX && !warnedmmx && cum->warn_mmx)
{
warnedmmx = true;
warning ("MMX vector argument without MMX enabled "
int fastcall; /* fastcall calling convention is used */
int sse_words; /* # sse words passed so far */
int sse_nregs; /* # sse registers available for passing */
+ int warn_sse; /* True when we want to warn about SSE ABI. */
+ int warn_mmx; /* True when we want to warn about MMX ABI. */
int sse_regno; /* next available sse register number */
int mmx_words; /* # mmx words passed so far */
int mmx_nregs; /* # mmx registers available for passing */