Hello! We can now use %ebx directly. Also, fix function operand type to match the operand type.
libgomp/ChangeLog: 2015-05-27 Uros Bizjak <ubiz...@gmail.com> * config/linux/x86/futex.h (sys_futex0) [!__x86_64__]: Change operand "op" to long. [__PIC__]: Remove sys_futex0 function. libitm/ChangeLog: 2015-05-27 Uros Bizjak <ubiz...@gmail.com> * config/linux/x86/futex_bits.h (sys_futex0) [!__x86_64__]: Change operand "op" to long. [__PIC__]: Remove sys_futex0 function. Tested on x86_64-linux-gnu {,-m32} and committed to mainline SVN. Uros.
Index: libgomp/config/linux/x86/futex.h =================================================================== --- libgomp/config/linux/x86/futex.h (revision 223766) +++ libgomp/config/linux/x86/futex.h (working copy) @@ -81,30 +81,11 @@ # define SYS_futex 240 # endif -# ifdef __PIC__ - static inline long -sys_futex0 (int *addr, int op, int val) +sys_futex0 (int *addr, long op, int val) { long res; - __asm volatile ("xchgl\t%%ebx, %2\n\t" - "int\t$0x80\n\t" - "xchgl\t%%ebx, %2" - : "=a" (res) - : "0"(SYS_futex), "r" (addr), "c"(op), - "d"(val), "S"(0) - : "memory"); - return res; -} - -# else - -static inline long -sys_futex0 (int *addr, int op, int val) -{ - long res; - __asm volatile ("int $0x80" : "=a" (res) : "0"(SYS_futex), "b" (addr), "c"(op), @@ -113,8 +94,6 @@ return res; } -# endif /* __PIC__ */ - static inline void futex_wait (int *addr, int val) { Index: libitm/config/linux/x86/futex_bits.h =================================================================== --- libitm/config/linux/x86/futex_bits.h (revision 223766) +++ libitm/config/linux/x86/futex_bits.h (working copy) @@ -46,30 +46,11 @@ # define SYS_futex 240 # endif -# ifdef __PIC__ - static inline long -sys_futex0 (std::atomic<int> *addr, int op, int val) +sys_futex0 (std::atomic<int> *addr, long op, int val) { long res; - __asm volatile ("xchgl\t%%ebx, %2\n\t" - "int\t$0x80\n\t" - "xchgl\t%%ebx, %2" - : "=a" (res) - : "0"(SYS_futex), "r" (addr), "c"(op), - "d"(val), "S"(0) - : "memory"); - return res; -} - -# else - -static inline long -sys_futex0 (std::atomic<int> *addr, int op, int val) -{ - long res; - __asm volatile ("int $0x80" : "=a" (res) : "0"(SYS_futex), "b" (addr), "c"(op), @@ -78,5 +59,4 @@ return res; } -# endif /* __PIC__ */ #endif /* __x86_64__ */