• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Simple test of non-fused compare/branch.
2
3; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \
4; RUN:   -allow-externally-defined-symbols | FileCheck %s
5; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \
6; RUN:   -allow-externally-defined-symbols | FileCheck --check-prefix=OPTM1 %s
7
8define internal void @icmpEqZero64() {
9entry:
10  %cmp = icmp eq i64 123, 0
11  br i1 %cmp, label %if.then, label %if.end
12
13if.then:                                          ; preds = %entry
14  call void @func()
15  br label %if.end
16
17if.end:                                          ; preds = %if.then, %if.end
18  ret void
19}
20; The following checks are not strictly necessary since one of the RUN
21; lines actually runs the output through the assembler.
22; CHECK-LABEL: icmpEqZero64
23; CHECK: or
24; CHECK-NOT: set
25; OPTM1-LABEL: icmpEqZero64
26; OPTM1: or
27; OPTM1-NEXT: sete
28
29define internal void @icmpNeZero64() {
30entry:
31  %cmp = icmp ne i64 123, 0
32  br i1 %cmp, label %if.then, label %if.end
33
34if.then:                                          ; preds = %entry
35  call void @func()
36  br label %if.end
37
38if.end:                                          ; preds = %if.then, %if.end
39  ret void
40}
41; The following checks are not strictly necessary since one of the RUN
42; lines actually runs the output through the assembler.
43; CHECK-LABEL: icmpNeZero64
44; CHECK: or
45; CHECK-NOT: set
46; OPTM1-LABEL: icmpNeZero64
47; OPTM1: or
48; OPTM1-NEXT: setne
49
50define internal void @icmpSgeZero64() {
51entry:
52  %cmp = icmp sge i64 123, 0
53  br i1 %cmp, label %if.then, label %if.end
54
55if.then:                                          ; preds = %entry
56  call void @func()
57  br label %if.end
58
59if.end:                                          ; preds = %if.then, %if.end
60  ret void
61}
62; The following checks are not strictly necessary since one of the RUN
63; lines actually runs the output through the assembler.
64; CHECK-LABEL: icmpSgeZero64
65; CHECK: test eax,0x80000000
66; CHECK-NOT: sete
67; OPTM1-LABEL: icmpSgeZero64
68; OPTM1: test eax,0x80000000
69; OPTM1-NEXT: sete
70
71define internal void @icmpSltZero64() {
72entry:
73  %cmp = icmp slt i64 123, 0
74  br i1 %cmp, label %if.then, label %if.end
75
76if.then:                                          ; preds = %entry
77  call void @func()
78  br label %if.end
79
80if.end:                                          ; preds = %if.then, %if.end
81  ret void
82}
83; The following checks are not strictly necessary since one of the RUN
84; lines actually runs the output through the assembler.
85; CHECK-LABEL: icmpSltZero64
86; CHECK: test eax,0x80000000
87; CHECK-NOT: setne
88; OPTM1-LABEL: icmpSltZero64
89; OPTM1: test eax,0x80000000
90; OPTM1-NEXT: setne
91
92define internal void @icmpUltZero64() {
93entry:
94  %cmp = icmp ult i64 123, 0
95  br i1 %cmp, label %if.then, label %if.end
96
97if.then:                                          ; preds = %entry
98  call void @func()
99  br label %if.end
100
101if.end:                                          ; preds = %if.then, %if.end
102  ret void
103}
104; The following checks are not strictly necessary since one of the RUN
105; lines actually runs the output through the assembler.
106; CHECK-LABEL: icmpUltZero64
107; CHECK: mov [[RESULT:.*]],0x0
108; CHECK-NEXT: cmp [[RESULT]],0x0
109; OPTM1-LABEL: icmpUltZero64
110; OPTM1: mov [[RESULT:.*]],0x0
111; OPTM1-NEXT: cmp [[RESULT]],0x0
112
113define internal void @icmpUgeZero64() {
114entry:
115  %cmp = icmp uge i64 123, 0
116  br i1 %cmp, label %if.then, label %if.end
117
118if.then:                                          ; preds = %entry
119  call void @func()
120  br label %if.end
121
122if.end:                                          ; preds = %if.then, %if.end
123  ret void
124}
125; The following checks are not strictly necessary since one of the RUN
126; lines actually runs the output through the assembler.
127; CHECK-LABEL: icmpUgeZero64
128; CHECK: mov [[RESULT:.*]],0x1
129; CHECK-NEXT: cmp [[RESULT]],0x0
130; OPTM1-LABEL: icmpUgeZero64
131; OPTM1: mov [[RESULT:.*]],0x1
132; OPTM1-NEXT: cmp [[RESULT]],0x0
133
134define internal void @icmpUltZero32() {
135entry:
136  %cmp = icmp ult i32 123, 0
137  br i1 %cmp, label %if.then, label %if.end
138
139if.then:                                          ; preds = %entry
140  %cmp_ext = zext i1 %cmp to i32
141  call void @use(i32 %cmp_ext)
142  br label %if.end
143
144if.end:                                          ; preds = %if.then, %if.end
145  ret void
146}
147; The following checks are not strictly necessary since one of the RUN
148; lines actually runs the output through the assembler.
149; CHECK-LABEL: icmpUltZero32
150; CHECK: mov [[RESULT:.*]],0x0
151; CHECK-NEXT: cmp [[RESULT]],0x0
152; OPTM1-LABEL: icmpUltZero32
153; OPTM1: mov [[RESULT:.*]],0x0
154; OPTM1: cmp [[RESULT]],0x0
155
156define internal void @icmpUgeZero32() {
157entry:
158  %cmp = icmp uge i32 123, 0
159  br i1 %cmp, label %if.then, label %if.end
160
161if.then:                                          ; preds = %entry
162  %cmp_ext = zext i1 %cmp to i32
163  call void @use(i32 %cmp_ext)
164  br label %if.end
165
166if.end:                                          ; preds = %if.then, %if.end
167  ret void
168}
169; The following checks are not strictly necessary since one of the RUN
170; lines actually runs the output through the assembler.
171; CHECK-LABEL: icmpUgeZero32
172; CHECK: mov [[RESULT:.*]],0x1
173; CHECK-NEXT: cmp [[RESULT]],0x0
174; OPTM1-LABEL: icmpUgeZero32
175; OPTM1: mov [[RESULT:.*]],0x1
176; OPTM1-NEXT: cmp [[RESULT]],0x0
177
178define internal void @icmpUltZero16() {
179entry:
180  %cmp = icmp ult i16 123, 0
181  br i1 %cmp, label %if.then, label %if.end
182
183if.then:                                          ; preds = %entry
184  %cmp_ext = zext i1 %cmp to i32
185  call void @use(i32 %cmp_ext)
186  br label %if.end
187
188if.end:                                          ; preds = %if.then, %if.end
189  ret void
190}
191; The following checks are not strictly necessary since one of the RUN
192; lines actually runs the output through the assembler.
193; CHECK-LABEL: icmpUltZero16
194; CHECK: mov [[RESULT:.*]],0x0
195; CHECK-NEXT: cmp [[RESULT]],0x0
196; OPTM1-LABEL: icmpUltZero16
197; OPTM1: mov [[RESULT:.*]],0x0
198; OPTM1-NEXT: cmp [[RESULT]],0x0
199
200define internal void @icmpUgeZero16() {
201entry:
202  %cmp = icmp uge i16 123, 0
203  br i1 %cmp, label %if.then, label %if.end
204
205if.then:                                          ; preds = %entry
206  %cmp_ext = zext i1 %cmp to i32
207  call void @use(i32 %cmp_ext)
208  br label %if.end
209
210if.end:                                          ; preds = %if.then, %if.end
211  ret void
212}
213; The following checks are not strictly necessary since one of the RUN
214; lines actually runs the output through the assembler.
215; CHECK-LABEL: icmpUgeZero16
216; CHECK: mov [[RESULT:.*]],0x1
217; CHECK-NEXT: cmp [[RESULT]],0x0
218; OPTM1-LABEL: icmpUgeZero16
219; OPTM1: mov [[RESULT:.*]],0x1
220; OPTM1-NEXT: cmp [[RESULT]],0x0
221
222define internal void @icmpUltZero8() {
223entry:
224  %cmp = icmp ult i8 123, 0
225  br i1 %cmp, label %if.then, label %if.end
226
227if.then:                                          ; preds = %entry
228  %cmp_ext = zext i1 %cmp to i32
229  call void @use(i32 %cmp_ext)
230  br label %if.end
231
232if.end:                                          ; preds = %if.then, %if.end
233  ret void
234}
235; The following checks are not strictly necessary since one of the RUN
236; lines actually runs the output through the assembler.
237; CHECK-LABEL: icmpUltZero8
238; CHECK: mov [[RESULT:.*]],0x0
239; CHECK-NEXT: cmp [[RESULT]],0x0
240; OPTM1-LABEL: icmpUltZero8
241; OPTM1: mov [[RESULT:.*]],0x0
242; OPTM1-NEXT: cmp [[RESULT]],0x0
243
244define internal void @icmpUgeZero8() {
245entry:
246  %cmp = icmp uge i8 123, 0
247  br i1 %cmp, label %if.then, label %if.end
248
249if.then:                                          ; preds = %entry
250  %cmp_ext = zext i1 %cmp to i32
251  call void @use(i32 %cmp_ext)
252  br label %if.end
253
254if.end:                                          ; preds = %if.then, %if.end
255  ret void
256}
257; The following checks are not strictly necessary since one of the RUN
258; lines actually runs the output through the assembler.
259; CHECK-LABEL: icmpUgeZero8
260; CHECK: mov [[RESULT:.*]],0x1
261; CHECK-NEXT: cmp [[RESULT]],0x0
262; OPTM1-LABEL: icmpUgeZero8
263; OPTM1: mov [[RESULT:.*]],0x1
264; OPTM1-NEXT: cmp [[RESULT]],0x0
265
266declare void @func()
267declare void @use(i32)
268