From 72cb81c45aa59001ed36667d2792170ea037242c Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Sat, 4 Jul 2026 23:41:58 +0200 Subject: [PATCH] atomic: make atomic_cmpxchg branchless Co-authored-by: wuangg <3d7777456@gmail.com> Signed-off-by: Michael Shaw --- amd64/kernel/atomic.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/amd64/kernel/atomic.S b/amd64/kernel/atomic.S index 75d54e5..0532e3d 100644 --- a/amd64/kernel/atomic.S +++ b/amd64/kernel/atomic.S @@ -4,11 +4,8 @@ atomic_cmpxchg: mov eax, esi lock cmpxchg [rdi], edx - jnz .Lnz - xor eax, eax - ret -.Lnz: - mov eax, 1 + setnz al + movzx eax, al ret .global atomic_xadd