This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: System V Application Binary Interface 0.99.5
On 01/30/2013 03:46 PM, Richard Biener wrote:
> On Wed, Jan 30, 2013 at 3:22 PM, Andrew Haley <aph@redhat.com> wrote:
>> Hi,
>>
>> On 01/30/2013 02:18 PM, Michael Matz wrote:
>>
>>> On Wed, 30 Jan 2013, Andrew Haley wrote:
>>>
>>>> I'm looking at Section 3.2.3, Parameter Passing.
>>>> http://artfiles.org/kernel.org/pub/scm/devel/binutils/hjl/x86-64-psabi.git/
>>>>
>>>> I still cannot tell whether parameters should or should not be sign- or
>>>> zero-extended when they are moved into registers at a call. I'm guessing
>>>> not.
>>>
>>> It's intentionally unspecified.
>>
>> Aha! It would have been nice if the psABI said so explicitly. Quite
>> a few people have spent time trying to find this information.
>>
>>>> Which is it? This is important for interworking.
>>>
>>> How? You aren't allowed to access the bits outside the specified argument
>>> type (which must match on caller and callee side), so you can't observe
>>> them, so it's not required to specify their content.
>>
>> OK, thanks. It's clear now.
>>
>> The problem is that LLVM assumes that values are extended at a call. GCC
>> does that, but libffi doesn't. So, calls via libffi to LLVM don't work
>> correctly.
>
> It's an optimization to do so to avoid partial register stalls.
Well, it's hardly an optimization if it's incorrect, and it seems to be
incorrect. As the old saying goes, I can make your code infinitely fast
if you don't care about the results.
Andrew.