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

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

Issue 1406593003: Optimize 64-bit compares with zero (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add isZero utility function, fix comments. 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
« no previous file with comments | « tests_lit/assembler/x86/jump_encodings.ll ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 %s
7
8 define internal void @icmpEqZero64() {
9 entry:
10 %cmp = icmp eq i64 123, 0
11 br i1 %cmp, label %if.then, label %if.end
12
13 if.then: ; preds = %entry
14 call void @func()
15 br label %if.end
16
17 if.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-NEXT: sete
25
26 define internal void @icmpNeZero64() {
27 entry:
28 %cmp = icmp ne i64 123, 0
29 br i1 %cmp, label %if.then, label %if.end
30
31 if.then: ; preds = %entry
32 call void @func()
33 br label %if.end
34
35 if.end: ; preds = %if.then, %if.end
36 ret void
37 }
38 ; The following checks are not strictly necessary since one of the RUN
39 ; lines actually runs the output through the assembler.
40 ; CHECK-LABEL: icmpNeZero64
41 ; CHECK: or
42 ; CHECK-NEXT: setne
43
44 define internal void @icmpSgeZero64() {
45 entry:
46 %cmp = icmp sge i64 123, 0
47 br i1 %cmp, label %if.then, label %if.end
48
49 if.then: ; preds = %entry
50 call void @func()
51 br label %if.end
52
53 if.end: ; preds = %if.then, %if.end
54 ret void
55 }
56 ; The following checks are not strictly necessary since one of the RUN
57 ; lines actually runs the output through the assembler.
58 ; CHECK-LABEL: icmpSgeZero64
59 ; CHECK: test eax,0x80000000
60 ; CHECK-NEXT: sete
61
62 define internal void @icmpSltZero64() {
63 entry:
64 %cmp = icmp slt i64 123, 0
65 br i1 %cmp, label %if.then, label %if.end
66
67 if.then: ; preds = %entry
68 call void @func()
69 br label %if.end
70
71 if.end: ; preds = %if.then, %if.end
72 ret void
73 }
74 ; The following checks are not strictly necessary since one of the RUN
75 ; lines actually runs the output through the assembler.
76 ; CHECK-LABEL: icmpSltZero64
77 ; CHECK: test eax,0x80000000
78 ; CHECK-NEXT: setne
79
80 define internal void @icmpUltZero64() {
81 entry:
82 %cmp = icmp ult i64 123, 0
83 br i1 %cmp, label %if.then, label %if.end
84
85 if.then: ; preds = %entry
86 call void @func()
87 br label %if.end
88
89 if.end: ; preds = %if.then, %if.end
90 ret void
91 }
92 ; The following checks are not strictly necessary since one of the RUN
93 ; lines actually runs the output through the assembler.
94 ; CHECK-LABEL: icmpUltZero64
95 ; CHECK: mov [[RESULT:.*]],0x0
96 ; CHECK-NEXT: cmp [[RESULT]],0x0
97
98 define internal void @icmpUgeZero64() {
99 entry:
100 %cmp = icmp uge i64 123, 0
101 br i1 %cmp, label %if.then, label %if.end
102
103 if.then: ; preds = %entry
104 call void @func()
105 br label %if.end
106
107 if.end: ; preds = %if.then, %if.end
108 ret void
109 }
110 ; The following checks are not strictly necessary since one of the RUN
111 ; lines actually runs the output through the assembler.
112 ; CHECK-LABEL: icmpUgeZero64
113 ; CHECK: mov [[RESULT:.*]],0x1
114 ; CHECK-NEXT: cmp [[RESULT]],0x0
115
116 define internal void @icmpUltZero32() {
117 entry:
118 %cmp = icmp ult i32 123, 0
119 br i1 %cmp, label %if.then, label %if.end
120
121 if.then: ; preds = %entry
122 %cmp_ext = zext i1 %cmp to i32
123 call void @use(i32 %cmp_ext)
124 br label %if.end
125
126 if.end: ; preds = %if.then, %if.end
127 ret void
128 }
129 ; The following checks are not strictly necessary since one of the RUN
130 ; lines actually runs the output through the assembler.
131 ; CHECK-LABEL: icmpUltZero32
132 ; CHECK: mov [[RESULT:.*]],0x0
133 ; CHECK-NEXT: cmp [[RESULT]],0x0
134
135 define internal void @icmpUgeZero32() {
136 entry:
137 %cmp = icmp uge i32 123, 0
138 br i1 %cmp, label %if.then, label %if.end
139
140 if.then: ; preds = %entry
141 %cmp_ext = zext i1 %cmp to i32
142 call void @use(i32 %cmp_ext)
143 br label %if.end
144
145 if.end: ; preds = %if.then, %if.end
146 ret void
147 }
148 ; The following checks are not strictly necessary since one of the RUN
149 ; lines actually runs the output through the assembler.
150 ; CHECK-LABEL: icmpUgeZero32
151 ; CHECK: mov [[RESULT:.*]],0x1
152 ; CHECK-NEXT: cmp [[RESULT]],0x0
153
154 define internal void @icmpUltZero16() {
155 entry:
156 %cmp = icmp ult i16 123, 0
157 br i1 %cmp, label %if.then, label %if.end
158
159 if.then: ; preds = %entry
160 %cmp_ext = zext i1 %cmp to i32
161 call void @use(i32 %cmp_ext)
162 br label %if.end
163
164 if.end: ; preds = %if.then, %if.end
165 ret void
166 }
167 ; The following checks are not strictly necessary since one of the RUN
168 ; lines actually runs the output through the assembler.
169 ; CHECK-LABEL: icmpUltZero16
170 ; CHECK: mov [[RESULT:.*]],0x0
171 ; CHECK-NEXT: cmp [[RESULT]],0x0
172
173 define internal void @icmpUgeZero16() {
174 entry:
175 %cmp = icmp uge i16 123, 0
176 br i1 %cmp, label %if.then, label %if.end
177
178 if.then: ; preds = %entry
179 %cmp_ext = zext i1 %cmp to i32
180 call void @use(i32 %cmp_ext)
181 br label %if.end
182
183 if.end: ; preds = %if.then, %if.end
184 ret void
185 }
186 ; The following checks are not strictly necessary since one of the RUN
187 ; lines actually runs the output through the assembler.
188 ; CHECK-LABEL: icmpUgeZero16
189 ; CHECK: mov [[RESULT:.*]],0x1
190 ; CHECK-NEXT: cmp [[RESULT]],0x0
191
192 define internal void @icmpUltZero8() {
193 entry:
194 %cmp = icmp ult i8 123, 0
195 br i1 %cmp, label %if.then, label %if.end
196
197 if.then: ; preds = %entry
198 %cmp_ext = zext i1 %cmp to i32
199 call void @use(i32 %cmp_ext)
200 br label %if.end
201
202 if.end: ; preds = %if.then, %if.end
203 ret void
204 }
205 ; The following checks are not strictly necessary since one of the RUN
206 ; lines actually runs the output through the assembler.
207 ; CHECK-LABEL: icmpUltZero8
208 ; CHECK: mov [[RESULT:.*]],0x0
209 ; CHECK-NEXT: cmp [[RESULT]],0x0
210
211 define internal void @icmpUgeZero8() {
212 entry:
213 %cmp = icmp uge i8 123, 0
214 br i1 %cmp, label %if.then, label %if.end
215
216 if.then: ; preds = %entry
217 %cmp_ext = zext i1 %cmp to i32
218 call void @use(i32 %cmp_ext)
219 br label %if.end
220
221 if.end: ; preds = %if.then, %if.end
222 ret void
223 }
224 ; The following checks are not strictly necessary since one of the RUN
225 ; lines actually runs the output through the assembler.
226 ; CHECK-LABEL: icmpUgeZero8
227 ; CHECK: mov [[RESULT:.*]],0x1
228 ; CHECK-NEXT: cmp [[RESULT]],0x0
229
230 declare void @func()
231 declare void @use(i32)
OLDNEW
« no previous file with comments | « tests_lit/assembler/x86/jump_encodings.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698