[llvm] [X86][Atomic] Fix bts/btr/btc regression caused by InstCombine trunc to i1 (PR #200667)

Jiří Filek via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 7 01:44:08 PDT 2026


================
@@ -7014,3 +7014,61 @@ cont11:  ; No predecessors!
 if.end19:  ; preds = %cont11, %entry
   ret void
 }
+
+; Regression tests that bts recognizes trunc to i1
+define i1 @atomic_or_1_trunc_i1(ptr %v) nounwind {
+; X86-LABEL: atomic_or_1_trunc_i1:
+; X86:       # %bb.0: # %entry
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    lock btsl $0, (%eax)
+; X86-NEXT:    setb %al
+; X86-NEXT:    retl
+;
+; X64-LABEL: atomic_or_1_trunc_i1:
+; X64:       # %bb.0: # %entry
+; X64-NEXT:    lock btsl $0, (%rdi)
+; X64-NEXT:    setb %al
+; X64-NEXT:    retq
+entry:
+  %0 = atomicrmw or ptr %v, i32 1 monotonic, align 4
----------------
fileho wrote:

done

https://github.com/llvm/llvm-project/pull/200667


More information about the llvm-commits mailing list