On Wed, Jul 8, 2026 at 4:37 PM Hongtao Liu <[email protected]> wrote:
>
> On Wed, Jul 8, 2026 at 2:03 PM 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.
> >
>
> 1) gcc/config/i386/i386.cc:4802 still uses cum->call_abi == MS_ABI for
> incoming varargs. x86_64_cumulative_ms_abi_p should also be used
> there?
>
> 4802 if (cum->call_abi == MS_ABI)
> 4803 setup_incoming_varargs_ms_64 (&next_cum);
> 4804 else
> 4805 setup_incoming_varargs_64 (&next_cum);
> 4806}
Fixed in the v2 patch with tests
> 2) gcc/config/i386/i386.cc:3644 has the same raw MS ABI test in
> ix86_pass_by_reference?
Fixed in the v2 patch with tests.
> 3634static bool
> 3635ix86_pass_by_reference (cumulative_args_t cum_v, const
> function_arg_info &arg)
> 3636{
> 3637 CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
> 3638
> 3639 if (TARGET_64BIT)
> 3640 {
> 3641 enum calling_abi call_abi = cum ? cum->call_abi : ix86_abi;
> 3642
> 3643 /* See Windows x64 Software Convention. */
> 3644 if (call_abi == MS_ABI)
> 3645 {
> 3646 HOST_WIDE_INT msize = GET_MODE_SIZE (arg.mode);
> 3647
>
> One question, under MS_ABI use 4 registers for parameter passing,
> SYSV_ABI use 8, under preserve_none, should we also use 8 registers
> for parameter passing for MS_ABI?
>
It has 8 registers. Tests show that
x86_64_preserve_none_int_parameter_registers
is used for functions with __attribute__ ((preserve_none, ms_abi)).
--
H.J.