On Thu, Jul 9, 2026 at 9:41 AM H.J. Lu <[email protected]> wrote:
>
> In 64-bit mode, preserve_none attribute uses a different calling
> convention.  Ignore MS ABI with preserve_none attribute to always
> use the preserve_none calling convention with preserve_none
> attribute.
>
> gcc/
>

>
> It has 8 registers.   Tests show that
> x86_64_preserve_none_int_parameter_registers
> is used for functions with __attribute__ ((preserve_none, ms_abi)).
I mean for sse registers, init_cumulative_args sets the integer count
via the new predicate but leaves the SSE count keyed on the raw ABI
(i386.cc:1940):

927  /* Set up the number of registers to use for passing arguments.  */
928  cum->nregs = ix86_regparm;
929  if (TARGET_64BIT)
930    {
931      cum->nregs = (x86_64_cumulative_ms_abi_p (cum)
932                    ? X86_64_MS_REGPARM_MAX
933                    : X86_64_REGPARM_MAX);
934    }
935  if (TARGET_SSE)
936    {
937      cum->sse_nregs = SSE_REGPARM_MAX;
938      if (TARGET_64BIT)
939        {
940          cum->sse_nregs = (cum->call_abi == SYSV_ABI
941                           ? X86_64_SSE_REGPARM_MAX
942                           : X86_64_MS_SSE_REGPARM_MAX);
943        }
944    }


 if  -mabi=ms is in the command line, with plain preserve_none in the
attribute, only 4 sse registers is used for parameter passing
But with __attribute__ ((preserve_none, ms_abi)), 8 sse registers are
used for parameter passing.

.i.e
void bar(double,double,double,double,double,double)
__attribute__((preserve_none));

void
entry (long a1, long a2, long a3, long a4, long a5, long a6)
{
bar (a1, a2, a3, a4, a5, a6);
}






--
BR,
Hongtao

Reply via email to