[PATCH v2] x86: Use flag output operands for inline asm in atomic-machine.h
Florian Weimer
fweimer@redhat.com
Wed Aug 27 07:56:56 GMT 2025
* Uros Bizjak:
> Use the flag output constraints feature available in gcc 6+
> ("=@cc<cond>") instead of explicitly setting a boolean variable
> with SETcc instruction. This approach decouples the instruction
> that sets the flags from the code that consumes them, allowing
> the compiler to create better code when working with flags users.
> Instead of e.g.:
>
> lock add %esi,(%rdi)
> sets %sil
> test %sil,%sil
> jne <...>
>
> the compiler now generates:
>
> lock add %esi,(%rdi)
> js <...>
>
> No functional changes intended.
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: H.J.Lu <hjl.tools@gmail.com>
> Cc: Florian Weimer <fweimer@redhat.com>
> Cc: Carlos O'Donell <carlos@redhat.com>
Thanks, this now looks good to me.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Florian
More information about the Libc-alpha
mailing list