Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: tests_lit/llvm2ice_tests/icmp-with-zero.ll

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

Powered by Google App Engine
This is Rietveld 408576698