[cfe-commits] r145574 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp lib/CodeGen/TargetInfo.cpp lib/CodeGen/TargetInfo.h test/CodeGen/x86_64-arguments.c

John McCall rjmccall at apple.com
Wed Nov 30 22:37:09 PST 2011


On Nov 30, 2011, at 10:05 PM, Eli Friedman wrote:

> On Wed, Nov 30, 2011 at 9:40 PM, John McCall <rjmccall at apple.com> wrote:
>> On Nov 30, 2011, at 8:53 PM, Eli Friedman wrote:
>>> Author: efriedma
>>> Date: Wed Nov 30 22:53:19 2011
>>> New Revision: 145574
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=145574&view=rev
>>> Log:
>>> Don't use a varargs convention for calls unprototyped functions where one of the arguments is an AVX vector.
>> 
>> Why not?  Does the backend just not correctly handle passing AVX vectors through varargs yet?
> 
> Passing an AVX vector through varargs forces it onto the stack, as
> opposed to the normal convention which passes it in a YMM register.
> Therefore, without this fix, we'll generate wrong code for the given
> testcase.

Aha, I see this in the ABI now.  Please clarify your comment to say that AVX
arguments are an exception specifically called out by the ABI as being
passed differently under varargs rules.  It might also be worth mentioning
that we're intentionally defining behavior that the ABI describes as undefined. :)

Also, your code is applying this rule to all objects which would otherwise be
passed in a YMM register (including e.g. struct { __m256 x; }), and while I
think that's the right thing to do, it's not technically what the ABI says and we
should push this suggestion up the chain.

John.



More information about the cfe-commits mailing list