Oleh Derevenko(deleted)
|
_smp_cmpxchg needlessly restricts register allocator to %ecx and %edx
|
Oleh Derevenko(deleted)
08/11/2011 9:59 AM
post88012
|
_smp_cmpxchg needlessly restricts register allocator to %ecx and %edx
In implementation for x86 in 6.5.0 _smp_cmpxchg needlessly restricts arguments to %ecx and %edx registers.
static __inline int __attribute__((__unused__)) _smp_cmpxchg(volatile unsigned *__dst, unsigned __cmd, unsigned __new) {
__asm__ __volatile__(
"lock; cmpxchgl %3, (%2)"
:"=m" (__atomic_fool_gcc(__dst)), "=a" (__cmd)
:"d" (__dst), "c" (__new), "1" (__cmd)
:"memory");
return __cmd;
}
It could be easily changed to avoid incurring that restriction.
static __inline int __attribute__((__unused__)) _smp_cmpxchg(volatile unsigned *__dst, unsigned __cmd, unsigned __new) {
__asm__ __volatile__(
"lock; cmpxchgl %3, %0"
:"=m" (__atomic_fool_gcc(__dst)), "=a" (__cmd)
:"m" (*__dst), "r" (__new), "1" (__cmd)
:"memory");
return __cmd;
}
|
|
|