[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / X86 / xchg-nofold.ll
blob939fa0404223de5c1ed667fb5113aea45858e5a0
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu < %s | FileCheck %s
4 %"struct.std::atomic" = type { %"struct.std::atomic_bool" }
5 %"struct.std::atomic_bool" = type { %"struct.std::__atomic_base" }
6 %"struct.std::__atomic_base" = type { i8 }
8 ; CHECK-LABEL: _Z3fooRSt6atomicIbEb
9 define zeroext i1 @_Z3fooRSt6atomicIbEb(%"struct.std::atomic"* nocapture dereferenceable(1) %a, i1 returned zeroext %b) nounwind {
10 ; CHECK-LABEL: _Z3fooRSt6atomicIbEb:
11 ; CHECK:       # BB#0: # %entry
12 ; CHECK-NEXT:    movq %rdi, %rax
13 ; CHECK-NEXT:    shrq $3, %rax
14 ; CHECK-NEXT:    movb 2147450880(%rax), %al
15 ; CHECK-NEXT:    testb %al, %al
16 ; CHECK-NEXT:    je .LBB0_3
17 ; CHECK-NEXT:  # BB#1:
18 ; CHECK-NEXT:    movl %edi, %ecx
19 ; CHECK-NEXT:    andl $7, %ecx
20 ; CHECK-NEXT:    cmpb %al, %cl
21 ; CHECK-NEXT:    jge .LBB0_2
22 ; CHECK-NEXT:  .LBB0_3:
23 ; CHECK-NEXT:    movl %esi, %eax
24 ; CHECK-NEXT:    xchgb %al, (%rdi)
25 ; CHECK-NEXT:    movl %esi, %eax
26 ; CHECK-NEXT:    retq
27 ; CHECK-NEXT:  .LBB0_2:
28 ; CHECK-NEXT:    pushq %rax
29 ; CHECK-NEXT:    callq __asan_report_store1
30 ; CHECK-NEXT:    #APP
31 ; CHECK-NEXT:    #NO_APP
32 entry:
33   %frombool.i.i = zext i1 %b to i8
34   %_M_i.i.i = getelementptr inbounds %"struct.std::atomic", %"struct.std::atomic"* %a, i64 0, i32 0, i32 0, i32 0
35   %0 = ptrtoint i8* %_M_i.i.i to i64
36   %1 = lshr i64 %0, 3
37   %2 = add i64 %1, 2147450880
38   %3 = inttoptr i64 %2 to i8*
39   %4 = load i8, i8* %3
40   %5 = icmp ne i8 %4, 0
41   br i1 %5, label %6, label %11
43 ; <label>:6:                                      ; preds = %entry
44   %7 = and i64 %0, 7
45   %8 = trunc i64 %7 to i8
46   %9 = icmp sge i8 %8, %4
47   br i1 %9, label %10, label %11
49 ; <label>:10:                                     ; preds = %6
50   call void @__asan_report_store1(i64 %0)
51   call void asm sideeffect "", ""()
52   unreachable
54 ; <label>:11:                                     ; preds = %6, %entry
55   store atomic i8 %frombool.i.i, i8* %_M_i.i.i seq_cst, align 1
56   ret i1 %b
59 declare void @__asan_report_store1(i64)