https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103069

--- Comment #10 from Thiago Macieira <thiago at kde dot org> ---
(In reply to H.J. Lu from comment #9)
> nptl/nptl_setxid.c in glibc has
> 
>   do  
>     {   
>       flags = THREAD_GETMEM (self, cancelhandling);
>       newval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling,
>                                           flags & ~SETXID_BITMASK, flags);
>     }   
>   while (flags != newval);
> 
> GCC 12 generates:
> 
>        899f0: 64 8b 14 25 08 03 00    mov    %fs:0x308,%edx
>        899f8: 89 d6                   mov    %edx,%esi
>        899fa: 89 d0                   mov    %edx,%eax
>        899fc: 83 e6 bf                and    $0xffffffbf,%esi
>        899ff: f0 0f b1 31             lock cmpxchg %esi,(%rcx)       
>        89a03: 75 eb                   jne    899f0 <__GI___nptl_setxid_sighand
> ler+0x90>

This one is a single bit. This one should be replaced with a LOCK BTC and no
loop.

Reply via email to