x86/atom: use neg instead of not/inc

The x86 apparently has a dedicated instruction for
finding the 2's complement.
main
anna 3 years ago
parent ea89961ed2
commit 6865864444
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -158,7 +158,7 @@ inline int atom_or(atom_t *atom, int val)
__asm__ volatile(
" movl (%2), %0 \n" /* eax = atom->_value */
"1: orl %0, %1 \n" /* eax |= eax */
"1: orl %0, %1 \n" /* val |= eax */
" lock \n"
" cmpxchgl %1, (%2) \n" /* if (atom->_value == eax) atom->_value = eax */
" jne 1b \n" /* else goto 1 (eax updated to new atom->_value) */

@ -90,8 +90,7 @@ ASM_ENTRY(atom_sub)
mov 8(%ebp), %edx
mov 12(%ebp), %eax
/* there is no xsubl, so we add the two's complement */
not %eax
inc %eax
neg %eax
lock
xaddl %eax, (%edx)

Loading…
Cancel
Save