[patch] Change inline asm to work with llvm-gcc

Chris Lattner clattner@apple.com
Tue Dec 23 18:03:00 GMT 2008


On Dec 23, 2008, at 9:21 AM, Jakub Jelinek wrote:

> On Tue, Dec 23, 2008 at 05:14:56PM +0000, Rafael Espindola wrote:
>>> Personally, I think it is an llvm bug. If it isn't 100% compatible  
>>> with
>>> gcc, it shouldn't say so. However, if gcc 4.2 has the same issue,
>>> it is an entirely different story.
>>
>> I have no idea if gcc 4.2 has the same issue or not. I don't know the
>> reason why llvm-gcc adds that requirement, but it looks reasonable to
>> have.
>
> What you find reasoanble on it?  The numbered constraint just says  
> that
> the same register is used for both the output and input, nothing else.

LLVM requires the same size, not the same type.  It prevents tying  
together a small output to a large input because the semantics are  
'vague'.  This is a new requirement and we can obviously change this  
back to work around glibc's headers.

>
> The requirement is that the mode (i.e. bit size and kind (integer,  
> floating,
> etc.) has to be the same, so that the same register can be used, but
> requiring the same type is pointless.

I don't believe that this is true: if so, where is it documented?  I  
have seen cases that tie together floating point and integer values  
from clearly different register files.  llvm-gcc also rejects these.

The idea of doing this is that the "front-end" can generate much  
better error messages than the late code generator can, so we prefer  
to do checking ahead of time.  People often get constraints and other  
details of inline asm wrong, and this is a particular issue that bites  
people building x86 inline asm that is intended to work on 32-bit and  
64-bit.

-Chris



More information about the Libc-alpha mailing list