This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Pass floating point values on powerpc64 as per ABI
- From: Alan Modra <amodra at gmail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Mon, 25 Nov 2013 20:24:39 +1030
- Subject: Re: Pass floating point values on powerpc64 as per ABI
- Authentication-results: sourceware.org; auth=none
- References: <20131116114805 dot GJ22514 at bubble dot grove dot modra dot org> <20131116115443 dot GM22514 at bubble dot grove dot modra dot org> <mvm61rqm5ww dot fsf at hawking dot suse dot de> <20131118233138 dot GW22514 at bubble dot grove dot modra dot org> <8738mt6xs4 dot fsf at igel dot home> <20131119004626 dot GY22514 at bubble dot grove dot modra dot org> <20131119005731 dot GZ22514 at bubble dot grove dot modra dot org> <mvmd2lwkaz4 dot fsf at hawking dot suse dot de>
On Tue, Nov 19, 2013 at 10:16:31AM +0100, Andreas Schwab wrote:
> Alan Modra <amodra@gmail.com> writes:
>
> > On Tue, Nov 19, 2013 at 11:16:26AM +1030, Alan Modra wrote:
> >> On Tue, Nov 19, 2013 at 01:27:39AM +0100, Andreas Schwab wrote:
> >> > Where does it call a varargs function?
> >>
> >> printf
> >
> > Sorry that wasn't such a helpful response.
> >
> > Here, really:
> > res = ((int(*)(char*, ...))(code))(format, doubleArg);
>
> But cls_double_va_fn doesn't expect a varargs call.
It works this way: The call shown above sets up arguments as for a
call to printf, and transfers control to a trampoline. On powerpc64
the trampoline bounces to ffi_closure_LINUX64. This assembly function
saves parameter passing registers to memory and calls some C code,
ffi_closure_helper_LINUX64, that uses information set up by
ffi_prep_cif_var to extract the arguments and package them up for
cls_double_va_fn. So it is ffi_closure_helper_LINUX64 that expects a
varargs call, under control of ffi_prep_cif_var.
It looks to me like the new libffi test failures on ia64 are due to
libffi on ia64 not differentiating between varargs and normal calls,
yet ia64 passes passes fp differently for varargs if I'm reading
gcc/config/ia64.c function_arg correctly.
--
Alan Modra
Australia Development Lab, IBM