1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
4 @val = internal global i64 0
5 @"\01LC" = internal constant [7 x i8] c"0x%lx\0A\00"
7 define i32 @main() nounwind {
9 ; CHECK: ## %bb.0: ## %entry
10 ; CHECK-NEXT: pushq %rax
11 ; CHECK-NEXT: movl $1, %ecx
12 ; CHECK-NEXT: xorl %eax, %eax
13 ; CHECK-NEXT: lock cmpxchgq %rcx, _val(%rip)
14 ; CHECK-NEXT: leaq LC(%rip), %rdi
15 ; CHECK-NEXT: movq %rax, %rsi
16 ; CHECK-NEXT: xorl %eax, %eax
17 ; CHECK-NEXT: callq _printf
18 ; CHECK-NEXT: xorl %eax, %eax
19 ; CHECK-NEXT: popq %rcx
22 %t0 = cmpxchg ptr @val, i64 0, i64 1 monotonic monotonic
23 %0 = extractvalue { i64, i1 } %t0, 0
24 %1 = tail call i32 (ptr, ...) @printf(ptr @"\01LC", i64 %0) nounwind
28 declare i32 @printf(ptr, ...) nounwind