PATCH: PR target/39473: Typo in untyped_call in i386.md
H.J. Lu
hongjiu.lu@intel.com
Mon Mar 16 21:06:00 GMT 2009
On Mon, Mar 16, 2009 at 12:20:42PM -0700, H.J. Lu wrote:
> Hi,
>
> SSE_REGPARM_MAX is defined as
>
> #define SSE_REGPARM_MAX \
> (TARGET_64BIT ? (TARGET_64BIT_MS_ABI ? X64_SSE_REGPARM_MAX \
> : X86_64_SSE_REGPARM_MAX) \
> : X86_32_SSE_REGPARM_MAX)
>
> untyped_call shouldn't assume 64bit ABI. Also ix86_expand_call has
>
> gcc_assert (!TARGET_64BIT || !pop);
>
> That means pop should be NULL in 64bit. There is no need for
>
> if (pop)
> {
> ...
> gcc_assert (ix86_cfun_abi () != MS_ABI || function_call_abi != SYSV_ABI);
> }
>
> since it will never happen and we only need to check ms->sysv ABI calls
> in 64bit mode. OK for trunk if there are no regressions on Linux/ia32
> and Linix/x86-64?
>
We can't use SSE_REGPARM_MAX here since callee is unprototyped
and should have the default ABI. Here is the updated patch. OK
for trunk if there are no regressions on Linux/ia32 and Linux/x86-64?
Thanks.
H.J.
---
2009-03-16 H.J. Lu <hongjiu.lu@intel.com>
PR target/39473
* config/i386/i386.c (ix86_expand_call): Check extra clobbers
for ms->sysv ABI calls only in 64bit mode.
* config/i386/i386.md (untyped_call): Support 32bit.
--- gcc/config/i386/i386.c.pr39473 2009-03-15 08:13:44.000000000 -0700
+++ gcc/config/i386/i386.c 2009-03-16 12:07:41.000000000 -0700
@@ -18617,12 +18617,7 @@ ix86_expand_call (rtx retval, rtx fnaddr
rtx pop, int sibcall)
{
rtx use = NULL, call;
- enum calling_abi function_call_abi;
- if (callarg2 && INTVAL (callarg2) == -2)
- function_call_abi = MS_ABI;
- else
- function_call_abi = SYSV_ABI;
if (pop == const0_rtx)
pop = NULL;
gcc_assert (!TARGET_64BIT || !pop);
@@ -18678,12 +18673,13 @@ ix86_expand_call (rtx retval, rtx fnaddr
pop = gen_rtx_PLUS (Pmode, stack_pointer_rtx, pop);
pop = gen_rtx_SET (VOIDmode, stack_pointer_rtx, pop);
call = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, call, pop));
- gcc_assert (ix86_cfun_abi () != MS_ABI || function_call_abi != SYSV_ABI);
}
- /* We need to represent that SI and DI registers are clobbered
- by SYSV calls. */
- if (ix86_cfun_abi () == MS_ABI && function_call_abi == SYSV_ABI)
+ if (TARGET_64BIT
+ && ix86_cfun_abi () == MS_ABI
+ && (!callarg2 || INTVAL (callarg2) != -2))
{
+ /* We need to represent that SI and DI registers are clobbered
+ by SYSV calls. */
static int clobbered_registers[] = {
XMM6_REG, XMM7_REG, XMM8_REG,
XMM9_REG, XMM10_REG, XMM11_REG,
--- gcc/config/i386/i386.md.pr39473 2009-03-15 08:13:44.000000000 -0700
+++ gcc/config/i386/i386.md 2009-03-16 13:50:07.000000000 -0700
@@ -15159,13 +15159,19 @@
/* In order to give reg-stack an easier job in validating two
coprocessor registers as containing a possible return value,
simply pretend the untyped call returns a complex long double
- value. */
+ value.
+
+ We can't use SSE_REGPARM_MAX here since callee is unprototyped
+ and should have the default ABI. */
ix86_expand_call ((TARGET_FLOAT_RETURNS_IN_80387
? gen_rtx_REG (XCmode, FIRST_FLOAT_REG) : NULL),
operands[0], const0_rtx,
- GEN_INT ((DEFAULT_ABI == SYSV_ABI ? X86_64_SSE_REGPARM_MAX
- : X64_SSE_REGPARM_MAX)
+ GEN_INT ((TARGET_64BIT
+ ? (DEFAULT_ABI == SYSV_ABI
+ ? X86_64_SSE_REGPARM_MAX
+ : X64_SSE_REGPARM_MAX)
+ : X86_32_SSE_REGPARM_MAX)
- 1),
NULL, 0);
More information about the Gcc-patches
mailing list