asm constraints on i686-linux and GCC 3.2 CVS
Andreas Jaeger
aj@suse.de
Sun Apr 7 03:24:00 GMT 2002
Richard,
I guess your recent changes to GCC mainline CVS introduced a number of
problems while compiling inline asms in glibc CVS on i686-linux-gnu.
I get this failure:
spinlock.c: In function `__pthread_lock':
spinlock.c:113: inconsistent operand constraints in an `asm'
The line is:
__asm __volatile ("" : "=m" (lock->__status) : "0" (lock->__status));
and lots of warnings like:
../sysdeps/i386/i486/atomicity.h:31: warning: asm operand 1 probably doesn't match constraints
../sysdeps/i386/i486/atomicity.h:31: warning: asm operand 3 probably doesn't match constraints
../sysdeps/i386/i486/atomicity.h:40: warning: asm operand 0 probably doesn't match constraints
../sysdeps/i386/i486/atomicity.h:40: warning: asm operand 2 probably doesn't match constraints
../sysdeps/i386/i486/atomicity.h:51: warning: asm operand 1 probably doesn't match constraints
../sysdeps/i386/i486/atomicity.h:51: warning: asm operand 4 probably doesn't match constraints
where the asms are:
__asm__ __volatile__ ("lock; xaddl %0,%1"
: "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem));
__asm__ __volatile__ ("lock; addl %1,%0"
: "=m" (*mem) : "ir" (val), "0" (*mem));
__asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
: "=q" (ret), "=m" (*p), "=a" (readval)
: "r" (newval), "1" (*p), "a" (oldval));
../sysdeps/i386/fpu/bits/mathinline.h:492: warning: asm operand 0 probably doesn't match constraints
../sysdeps/i386/fpu/bits/mathinline.h:503: warning: asm operand 0 probably doesn't match constraints
with these lines:
__inline_mathcodeNP (floor, __x, \
register long double __value; \
__volatile unsigned short int __cw; \
__volatile unsigned short int __cwtmp; \
__asm __volatile ("fnstcw %0" : "=m" (__cw)); \
__cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */ \
__asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \
__asm __volatile ("fldcw %0" : : "m" (__cw)); \
return __value)
__inline_mathcodeNP (ceil, __x, \
register long double __value; \
__volatile unsigned short int __cw; \
__volatile unsigned short int __cwtmp; \
__asm __volatile ("fnstcw %0" : "=m" (__cw)); \
__cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */ \
__asm __volatile ("fldcw %0" : : "m" (__cwtmp)); \
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); \
__asm __volatile ("fldcw %0" : : "m" (__cw)); \
return __value)
What's wrong here and how can this get fixed?
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
More information about the Libc-hacker
mailing list