This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Tue, Dec 23, 2008 at 09:38:22AM -0800, Chris Lattner wrote:
>> 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.

For i386 (32-bit) int and int * are the same size (integer 32-bit register),
so why does llvm complain then?
BTW, gcc apparently doesn't reject even different size:
int foo (int *p)
{
  int q;
  asm ("# %0 %1 " : "=r" (q) : "0" (p));
  return q;
}
for -m32 this shows # %eax %eax and for -m64 # %eax %rax
(in this case the behavior is obvious, of course you can write code where
you shoot yourself into the foot, but inline asm is a very low level
extension where the programmer must know what he is doing.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]