/* Return 1 or 2, if we can pass up to SSE_REGPARM_MAX SFmode (1) and
DFmode (2) arguments in SSE registers for a function with the
indicated TYPE and DECL. DECL may be NULL when calling function
- indirectly or considering a libcall. Otherwise return 0. */
+ indirectly or considering a libcall. Return -1 if any FP parameter
+ should be rejected by error. This is used in siutation we imply SSE
+ calling convetion but the function is called from another function with
+ SSE disabled. Otherwise return 0. */
static int
ix86_function_sseregparm (const_tree type, const_tree decl, bool warn)
{
/* Refuse to produce wrong code when local function with SSE enabled
is called from SSE disabled function.
- We may work hard to work out these scenarios but hopefully
- it doesnot matter in practice. */
+ FIXME: We need a way to detect these cases cross-ltrans partition
+ and avoid using SSE calling conventions on local functions called
+ from function with SSE disabled. For now at least delay the
+ warning until we know we are going to produce wrong code.
+ See PR66047 */
if (!TARGET_SSE && warn)
- {
- error ("calling %qD with SSE caling convention without "
- "SSE/SSE2 enabled", decl);
- return 0;
- }
+ return -1;
return TARGET_SSE2_P (target_opts_for_fn (target->decl)
->x_ix86_isa_flags) ? 2 : 1;
}
cum->bnd_regno = FIRST_BND_REG;
cum->bnds_in_bt = 0;
cum->force_bnd_pass = 0;
+ cum->decl = fndecl;
if (!TARGET_64BIT)
{
HOST_WIDE_INT words)
{
int res = 0;
+ bool error_p = NULL;
switch (mode)
{
gcc_unreachable ();
case DFmode:
+ if (cum->float_in_sse == -1)
+ error_p = 1;
if (cum->float_in_sse < 2)
break;
case SFmode:
+ if (cum->float_in_sse == -1)
+ error_p = 1;
if (cum->float_in_sse < 1)
break;
/* FALLTHRU */
}
break;
}
+ if (error_p)
+ {
+ cum->float_in_sse = 0;
+ error ("calling %qD with SSE calling convention without "
+ "SSE/SSE2 enabled", cum->decl);
+ sorry ("this is a GCC bug that can be worked around by adding "
+ "attribute used to function called");
+ }
return res;
}
(otherwise it is an extra parameter matching an ellipsis). */
static rtx
-function_arg_32 (const CUMULATIVE_ARGS *cum, machine_mode mode,
+function_arg_32 (CUMULATIVE_ARGS *cum, machine_mode mode,
machine_mode orig_mode, const_tree type,
HOST_WIDE_INT bytes, HOST_WIDE_INT words)
{
+ bool error_p = false;
/* Avoid the AL settings for the Unix64 ABI. */
if (mode == VOIDmode)
return constm1_rtx;
break;
case DFmode:
+ if (cum->float_in_sse == -1)
+ error_p = 1;
if (cum->float_in_sse < 2)
break;
case SFmode:
+ if (cum->float_in_sse == -1)
+ error_p = 1;
if (cum->float_in_sse < 1)
break;
/* FALLTHRU */
}
break;
}
+ if (error_p)
+ {
+ cum->float_in_sse = 0;
+ error ("calling %qD with SSE calling convention without "
+ "SSE/SSE2 enabled", cum->decl);
+ sorry ("this is a GCC bug that can be worked around by adding "
+ "attribute used to function called");
+ }
return NULL_RTX;
}
if ((fn || fntype) && (mode == SFmode || mode == DFmode))
{
int sse_level = ix86_function_sseregparm (fntype, fn, false);
- if ((sse_level >= 1 && mode == SFmode)
- || (sse_level == 2 && mode == DFmode))
+ if (sse_level == -1)
+ {
+ error ("calling %qD with SSE caling convention without "
+ "SSE/SSE2 enabled", fn);
+ sorry ("this is a GCC bug that can be worked around by adding "
+ "attribute used to function called");
+ }
+ else if ((sse_level >= 1 && mode == SFmode)
+ || (sse_level == 2 && mode == DFmode))
regno = FIRST_SSE_REG;
}