Bad gcc code for atomic_dec

Keith Owens (kaos@ocs.com.au)
Sun, 11 Jan 1998 21:25:44 +1100


gcc 2.7.2.3 for i586 generates an extra load for atomic_dec(&xxx). It
outputs

movl xxx,%ebx
lock decl xxx

and never uses the value in %ebx, wasting a register. Strangely
enough, atomic_inc is fine, just "lock incl xxx".