ARM & AArch64: make use of common cmpxchg idioms after expansion
[oota-llvm.git] / test / CodeGen / Thumb2 / v8_IT_5.ll
1 ; RUN: llc < %s -mtriple=thumbv8 -arm-atomic-cfg-tidy=0 | FileCheck %s
2 ; RUN: llc < %s -mtriple=thumbv7 -arm-atomic-cfg-tidy=0 -arm-restrict-it | FileCheck %s
3 ; CHECK: it     ne
4 ; CHECK-NEXT: cmpne
5 ; CHECK-NEXT: bne [[JUMPTARGET:.LBB[0-9]+_[0-9]+]]
6 ; CHECK: cmp
7 ; CHECK-NEXT: beq
8 ; CHECK-NEXT: %if.else163
9 ; CHECK-NEXT: mov.w
10 ; CHECK-NEXT: b
11 ; CHECK-NEXT: %if.else145
12 ; CHECK-NEXT: mov.w
13 ; CHECK: [[JUMPTARGET]]:{{.*}}%if.else173
14
15 %struct.hc = type { i32, i32, i32, i32 }
16
17 define i32 @t(i32 %type) optsize {
18 entry:
19   br i1 undef, label %if.then, label %if.else
20
21 if.then:
22   unreachable
23
24 if.else:
25   br i1 undef, label %if.then15, label %if.else18
26
27 if.then15:
28   unreachable
29
30 if.else18:
31   switch i32 %type, label %if.else173 [
32     i32 3, label %if.then115
33     i32 1, label %if.then102
34   ]
35
36 if.then102:
37   br i1 undef, label %cond.true10.i, label %t.exit
38
39 cond.true10.i:
40   br label %t.exit
41
42 t.exit:
43   unreachable
44
45 if.then115:
46   br i1 undef, label %if.else163, label %if.else145
47
48 if.else145:
49   %call150 = call fastcc %struct.hc* @foo(%struct.hc* undef, i32 34865152) optsize
50   br label %while.body172
51
52 if.else163:
53   %call168 = call fastcc %struct.hc* @foo(%struct.hc* undef, i32 34078720) optsize
54   br label %while.body172
55
56 while.body172:
57   br label %while.body172
58
59 if.else173:
60   ret i32 -1
61 }
62
63 declare hidden fastcc %struct.hc* @foo(%struct.hc* nocapture, i32) nounwind optsize
64