1; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=ARM
2; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi -verify-machineinstrs | FileCheck %s --check-prefix=ARM
3; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
4
5define void @t1a(float %a) uwtable ssp {
6entry:
7; ARM: t1a
8; THUMB: t1a
9  %cmp = fcmp oeq float %a, 0.000000e+00
10; ARM: vcmpe.f32 s{{[0-9]+}}, #0
11; THUMB: vcmpe.f32 s{{[0-9]+}}, #0
12  br i1 %cmp, label %if.then, label %if.end
13
14if.then:                                          ; preds = %entry
15  tail call void @foo()
16  br label %if.end
17
18if.end:                                           ; preds = %if.then, %entry
19  ret void
20}
21
22declare void @foo()
23
24; Shouldn't be able to encode -0.0 imm.
25define void @t1b(float %a) uwtable ssp {
26entry:
27; ARM: t1b
28; THUMB: t1b
29  %cmp = fcmp oeq float %a, -0.000000e+00
30; ARM: vldr
31; ARM: vcmpe.f32 s{{[0-9]+}}, s{{[0-9]+}}
32; THUMB: vldr
33; THUMB: vcmpe.f32 s{{[0-9]+}}, s{{[0-9]+}}
34  br i1 %cmp, label %if.then, label %if.end
35
36if.then:                                          ; preds = %entry
37  tail call void @foo()
38  br label %if.end
39
40if.end:                                           ; preds = %if.then, %entry
41  ret void
42}
43
44define void @t2a(double %a) uwtable ssp {
45entry:
46; ARM: t2a
47; THUMB: t2a
48  %cmp = fcmp oeq double %a, 0.000000e+00
49; ARM: vcmpe.f64 d{{[0-9]+}}, #0
50; THUMB: vcmpe.f64 d{{[0-9]+}}, #0
51  br i1 %cmp, label %if.then, label %if.end
52
53if.then:                                          ; preds = %entry
54  tail call void @foo()
55  br label %if.end
56
57if.end:                                           ; preds = %if.then, %entry
58  ret void
59}
60
61; Shouldn't be able to encode -0.0 imm.
62define void @t2b(double %a) uwtable ssp {
63entry:
64; ARM: t2b
65; THUMB: t2b
66  %cmp = fcmp oeq double %a, -0.000000e+00
67; ARM: vldr
68; ARM: vcmpe.f64 d{{[0-9]+}}, d{{[0-9]+}}
69; THUMB: vldr
70; THUMB: vcmpe.f64 d{{[0-9]+}}, d{{[0-9]+}}
71  br i1 %cmp, label %if.then, label %if.end
72
73if.then:                                          ; preds = %entry
74  tail call void @foo()
75  br label %if.end
76
77if.end:                                           ; preds = %if.then, %entry
78  ret void
79}
80
81define void @t4(i8 signext %a) uwtable ssp {
82entry:
83; ARM: t4
84; THUMB: t4
85  %cmp = icmp eq i8 %a, -1
86; ARM: cmn r{{[0-9]}}, #1
87; THUMB: cmn.w r{{[0-9]}}, #1
88  br i1 %cmp, label %if.then, label %if.end
89
90if.then:                                          ; preds = %entry
91  tail call void @foo()
92  br label %if.end
93
94if.end:                                           ; preds = %if.then, %entry
95  ret void
96}
97
98define void @t5(i8 zeroext %a) uwtable ssp {
99entry:
100; ARM: t5
101; THUMB: t5
102  %cmp = icmp eq i8 %a, 1
103; ARM: cmp r{{[0-9]}}, #1
104; THUMB: cmp r{{[0-9]}}, #1
105  br i1 %cmp, label %if.then, label %if.end
106
107if.then:                                          ; preds = %entry
108  tail call void @foo()
109  br label %if.end
110
111if.end:                                           ; preds = %if.then, %entry
112  ret void
113}
114
115define void @t6(i16 signext %a) uwtable ssp {
116entry:
117; ARM: t6
118; THUMB: t6
119  %cmp = icmp eq i16 %a, -1
120; ARM: cmn r{{[0-9]}}, #1
121; THUMB: cmn.w r{{[0-9]}}, #1
122  br i1 %cmp, label %if.then, label %if.end
123
124if.then:                                          ; preds = %entry
125  tail call void @foo()
126  br label %if.end
127
128if.end:                                           ; preds = %if.then, %entry
129  ret void
130}
131
132define void @t7(i16 zeroext %a) uwtable ssp {
133entry:
134; ARM: t7
135; THUMB: t7
136  %cmp = icmp eq i16 %a, 1
137; ARM: cmp r{{[0-9]}}, #1
138; THUMB: cmp r{{[0-9]}}, #1
139  br i1 %cmp, label %if.then, label %if.end
140
141if.then:                                          ; preds = %entry
142  tail call void @foo()
143  br label %if.end
144
145if.end:                                           ; preds = %if.then, %entry
146  ret void
147}
148
149define void @t8(i32 %a) uwtable ssp {
150entry:
151; ARM: t8
152; THUMB: t8
153  %cmp = icmp eq i32 %a, -1
154; ARM: cmn r{{[0-9]}}, #1
155; THUMB: cmn.w r{{[0-9]}}, #1
156  br i1 %cmp, label %if.then, label %if.end
157
158if.then:                                          ; preds = %entry
159  tail call void @foo()
160  br label %if.end
161
162if.end:                                           ; preds = %if.then, %entry
163  ret void
164}
165
166define void @t9(i32 %a) uwtable ssp {
167entry:
168; ARM: t9
169; THUMB: t9
170  %cmp = icmp eq i32 %a, 1
171; ARM: cmp r{{[0-9]}}, #1
172; THUMB: cmp r{{[0-9]}}, #1
173  br i1 %cmp, label %if.then, label %if.end
174
175if.then:                                          ; preds = %entry
176  tail call void @foo()
177  br label %if.end
178
179if.end:                                           ; preds = %if.then, %entry
180  ret void
181}
182
183define void @t10(i32 %a) uwtable ssp {
184entry:
185; ARM: t10
186; THUMB: t10
187  %cmp = icmp eq i32 %a, 384
188; ARM: cmp r{{[0-9]}}, #384
189; THUMB: cmp.w r{{[0-9]}}, #384
190  br i1 %cmp, label %if.then, label %if.end
191
192if.then:                                          ; preds = %entry
193  tail call void @foo()
194  br label %if.end
195
196if.end:                                           ; preds = %if.then, %entry
197  ret void
198}
199
200define void @t11(i32 %a) uwtable ssp {
201entry:
202; ARM: t11
203; THUMB: t11
204  %cmp = icmp eq i32 %a, 4096
205; ARM: cmp r{{[0-9]}}, #4096
206; THUMB: cmp.w r{{[0-9]}}, #4096
207  br i1 %cmp, label %if.then, label %if.end
208
209if.then:                                          ; preds = %entry
210  tail call void @foo()
211  br label %if.end
212
213if.end:                                           ; preds = %if.then, %entry
214  ret void
215}
216
217define void @t12(i8 %a) uwtable ssp {
218entry:
219; ARM: t12
220; THUMB: t12
221  %cmp = icmp ugt i8 %a, -113
222; ARM: cmp r{{[0-9]}}, #143
223; THUMB: cmp r{{[0-9]}}, #143
224  br i1 %cmp, label %if.then, label %if.end
225
226if.then:                                          ; preds = %entry
227  tail call void @foo()
228  br label %if.end
229
230if.end:                                           ; preds = %if.then, %entry
231  ret void
232}
233
234; rdar://11038907
235; When comparing LONG_MIN/INT_MIN use a cmp instruction.
236define void @t13() nounwind ssp {
237entry:
238; ARM: t13
239; THUMB: t13
240  %cmp = icmp slt i32 -123, -2147483648
241; ARM: cmp r{{[0-9]}}, #-2147483648
242; THUMB: cmp.w r{{[0-9]}}, #-2147483648
243  br i1 %cmp, label %if.then, label %if.end
244
245if.then:                                          ; preds = %entry
246  ret void
247
248if.end:                                           ; preds = %entry
249  ret void
250}
251
252