https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103066
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> --- Instead of generating: movl f(%rip), %eax .L2: movd %eax, %xmm0 addss .LC0(%rip), %xmm0 movd %xmm0, %edx lock cmpxchgl %edx, f(%rip) jne .L2 ret we want movl f(%rip), %eax .L2: movd %eax, %xmm0 addss .LC0(%rip), %xmm0 movd %xmm0, %edx cmpl f(%rip), %eax jne .L2 lock cmpxchgl %edx, f(%rip) jne .L2 ret