Convert more tests to avoid llvm-as.
[oota-llvm.git] / test / CodeGen / X86 / 2009-04-27-LiveIntervalsBug.ll
1 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | grep cmpxchgl | not grep eax
2 ; PR4076
3
4         type { i8, i8, i8 }             ; type %0
5         type { i32, i8** }              ; type %1
6         type { %3* }            ; type %2
7         type { %4 }             ; type %3
8         type { %5 }             ; type %4
9         type { %6, i32, %7 }            ; type %5
10         type { i8* }            ; type %6
11         type { i32, [12 x i8] }         ; type %7
12         type { %9 }             ; type %8
13         type { %10, %11*, i8 }          ; type %9
14         type { %11* }           ; type %10
15         type { i32, %6, i8*, %12, %13*, i8, i32, %28, %29, i32, %30, i32, i32, i32, i8*, i8*, i8, i8 }          ; type %11
16         type { %13* }           ; type %12
17         type { %14, i32, %13*, %21 }            ; type %13
18         type { %15, %16 }               ; type %14
19         type { i32 (...)** }            ; type %15
20         type { %17, i8* (i32)*, void (i8*)*, i8 }               ; type %16
21         type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %18 }         ; type %17
22         type { %19* }           ; type %18
23         type { i32, %20**, i32, %20**, i8** }           ; type %19
24         type { i32 (...)**, i32 }               ; type %20
25         type { %22, %25*, i8, i8, %17*, %26*, %27*, %27* }              ; type %21
26         type { i32 (...)**, i32, i32, i32, i32, i32, %23*, %24, [8 x %24], i32, %24*, %18 }             ; type %22
27         type { %23*, void (i32, %22*, i32)*, i32, i32 }         ; type %23
28         type { i8*, i32 }               ; type %24
29         type { i32 (...)**, %21 }               ; type %25
30         type { %20, i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }                ; type %26
31         type { %20 }            ; type %27
32         type { void (%9*)*, i32 }               ; type %28
33         type { %15* }           ; type %29
34         type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8* }          ; type %30
35 @AtomicOps_Internalx86CPUFeatures = external global %0          ; <%0*> [#uses=1]
36 internal constant [19 x i8] c"xxxxxxxxxxxxxxxxxx\00"            ; <[19 x i8]*>:0 [#uses=1]
37 internal constant [47 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\00"                ; <[47 x i8]*>:1 [#uses=1]
38
39 define i8** @func6(i8 zeroext, i32, i32, %1*) nounwind {
40 ; <label>:4
41         %5 = alloca i32, align 4                ; <i32*> [#uses=2]
42         %6 = alloca i32, align 4                ; <i32*> [#uses=2]
43         %7 = alloca %2, align 8         ; <%2*> [#uses=3]
44         %8 = alloca %8, align 8         ; <%8*> [#uses=2]
45         br label %17
46
47 ; <label>:9             ; preds = %17
48         %10 = getelementptr %1* %3, i32 %19, i32 0              ; <i32*> [#uses=1]
49         %11 = load i32* %10, align 4            ; <i32> [#uses=1]
50         %12 = icmp eq i32 %11, %2               ; <i1> [#uses=1]
51         br i1 %12, label %13, label %16
52
53 ; <label>:13            ; preds = %9
54         %14 = getelementptr %1* %3, i32 %19, i32 1              ; <i8***> [#uses=1]
55         %15 = load i8*** %14, align 4           ; <i8**> [#uses=1]
56         ret i8** %15
57
58 ; <label>:16            ; preds = %9
59         %indvar.next13 = add i32 %18, 1         ; <i32> [#uses=1]
60         br label %17
61
62 ; <label>:17            ; preds = %16, %4
63         %18 = phi i32 [ 0, %4 ], [ %indvar.next13, %16 ]                ; <i32> [#uses=2]
64         %19 = add i32 %18, %1           ; <i32> [#uses=3]
65         %20 = icmp sgt i32 %19, 3               ; <i1> [#uses=1]
66         br i1 %20, label %21, label %9
67
68 ; <label>:21            ; preds = %17
69         call void @func5()
70         %22 = getelementptr %1* %3, i32 0, i32 0                ; <i32*> [#uses=1]
71         %23 = load i32* %22, align 4            ; <i32> [#uses=1]
72         %24 = icmp eq i32 %23, 0                ; <i1> [#uses=1]
73         br i1 %24, label %._crit_edge, label %._crit_edge1
74
75 ._crit_edge1:           ; preds = %._crit_edge1, %21
76         %25 = phi i32 [ 0, %21 ], [ %26, %._crit_edge1 ]                ; <i32> [#uses=1]
77         %26 = add i32 %25, 1            ; <i32> [#uses=4]
78         %27 = getelementptr %1* %3, i32 %26, i32 0              ; <i32*> [#uses=1]
79         %28 = load i32* %27, align 4            ; <i32> [#uses=1]
80         %29 = icmp ne i32 %28, 0                ; <i1> [#uses=1]
81         %30 = icmp ne i32 %26, 4                ; <i1> [#uses=1]
82         %31 = and i1 %29, %30           ; <i1> [#uses=1]
83         br i1 %31, label %._crit_edge1, label %._crit_edge
84
85 ._crit_edge:            ; preds = %._crit_edge1, %21
86         %32 = phi i32 [ 0, %21 ], [ %26, %._crit_edge1 ]                ; <i32> [#uses=3]
87         %33 = call i8* @pthread_getspecific(i32 0) nounwind             ; <i8*> [#uses=2]
88         %34 = icmp ne i8* %33, null             ; <i1> [#uses=1]
89         %35 = icmp eq i8 %0, 0          ; <i1> [#uses=1]
90         %36 = or i1 %34, %35            ; <i1> [#uses=1]
91         br i1 %36, label %._crit_edge4, label %37
92
93 ; <label>:37            ; preds = %._crit_edge
94         %38 = call i8* @func2(i32 2048)         ; <i8*> [#uses=4]
95         call void @llvm.memset.i32(i8* %38, i8 0, i32 2048, i32 4)
96         %39 = call i32 @pthread_setspecific(i32 0, i8* %38) nounwind            ; <i32> [#uses=2]
97         store i32 %39, i32* %5
98         store i32 0, i32* %6
99         %40 = icmp eq i32 %39, 0                ; <i1> [#uses=1]
100         br i1 %40, label %41, label %43
101
102 ; <label>:41            ; preds = %37
103         %42 = getelementptr %2* %7, i32 0, i32 0                ; <%3**> [#uses=1]
104         store %3* null, %3** %42, align 8
105         br label %._crit_edge4
106
107 ; <label>:43            ; preds = %37
108         %44 = call %3* @func1(i32* %5, i32* %6, i8* getelementptr ([47 x i8]* @1, i32 0, i32 0))                ; <%3*> [#uses=2]
109         %45 = getelementptr %2* %7, i32 0, i32 0                ; <%3**> [#uses=1]
110         store %3* %44, %3** %45, align 8
111         %46 = icmp eq %3* %44, null             ; <i1> [#uses=1]
112         br i1 %46, label %._crit_edge4, label %47
113
114 ; <label>:47            ; preds = %43
115         call void @func4(%8* %8, i8* getelementptr ([19 x i8]* @0, i32 0, i32 0), i32 165, %2* %7)
116         call void @func3(%8* %8) noreturn
117         unreachable
118
119 ._crit_edge4:           ; preds = %43, %41, %._crit_edge
120         %48 = phi i8* [ %38, %41 ], [ %33, %._crit_edge ], [ %38, %43 ]         ; <i8*> [#uses=2]
121         %49 = bitcast i8* %48 to i8**           ; <i8**> [#uses=3]
122         %50 = icmp ne i8* %48, null             ; <i1> [#uses=1]
123         %51 = icmp slt i32 %32, 4               ; <i1> [#uses=1]
124         %52 = and i1 %50, %51           ; <i1> [#uses=1]
125         br i1 %52, label %53, label %._crit_edge6
126
127 ; <label>:53            ; preds = %._crit_edge4
128         %54 = getelementptr %1* %3, i32 %32, i32 0              ; <i32*> [#uses=1]
129         %55 = call i32 asm sideeffect "lock; cmpxchgl $1,$2", "={ax},q,*m,0,~{dirflag},~{fpsr},~{flags},~{memory}"(i32 %2, i32* %54, i32 0) nounwind            ; <i32> [#uses=1]
130         %56 = load i8* getelementptr (%0* @AtomicOps_Internalx86CPUFeatures, i32 0, i32 0), align 8             ; <i8> [#uses=1]
131         %57 = icmp eq i8 %56, 0         ; <i1> [#uses=1]
132         br i1 %57, label %._crit_edge7, label %58
133
134 ; <label>:58            ; preds = %53
135         call void asm sideeffect "lfence", "~{dirflag},~{fpsr},~{flags},~{memory}"() nounwind
136         br label %._crit_edge7
137
138 ._crit_edge7:           ; preds = %58, %53
139         %59 = icmp eq i32 %55, 0                ; <i1> [#uses=1]
140         br i1 %59, label %60, label %._crit_edge6
141
142 ._crit_edge6:           ; preds = %._crit_edge7, %._crit_edge4
143         ret i8** %49
144
145 ; <label>:60            ; preds = %._crit_edge7
146         %61 = getelementptr %1* %3, i32 %32, i32 1              ; <i8***> [#uses=1]
147         store i8** %49, i8*** %61, align 4
148         ret i8** %49
149 }
150
151 declare %3* @func1(i32* nocapture, i32* nocapture, i8*)
152
153 declare void @func5()
154
155 declare void @func4(%8*, i8*, i32, %2*)
156
157 declare void @func3(%8*) noreturn
158
159 declare i8* @pthread_getspecific(i32) nounwind
160
161 declare i8* @func2(i32)
162
163 declare void @llvm.memset.i32(i8* nocapture, i8, i32, i32) nounwind
164
165 declare i32 @pthread_setspecific(i32, i8*) nounwind