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

Side by Side Diff: tests_lit/llvm2ice_tests/adv-switch-opt.ll

Issue 1247833003: Handle UINT64_MAX edge case in switch lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 4 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 | « src/IceSwitchLowering.cpp ('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
1 ; This tests the advanced lowering of switch statements. The advanced lowering 1 ; This tests the advanced lowering of switch statements. The advanced lowering
2 ; uses jump tables, range tests and binary search. 2 ; uses jump tables, range tests and binary search.
3 3
4 ; RUN: %if --need=allow_dump --command %p2i -i %s --filetype=asm --assemble \ 4 ; RUN: %if --need=allow_dump --command %p2i -i %s --filetype=asm --assemble \
5 ; RUN: --disassemble --args --adv-switch -O2 | FileCheck %s 5 ; RUN: --disassemble --args --adv-switch -O2 | FileCheck %s
6 6
7 ; Dense but non-continuous ranges should be converted into a jump table. 7 ; Dense but non-continuous ranges should be converted into a jump table.
8 define internal i32 @testJumpTable(i32 %a) { 8 define internal i32 @testJumpTable(i32 %a) {
9 entry: 9 entry:
10 switch i32 %a, label %sw.default [ 10 switch i32 %a, label %sw.default [
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ; CHECK-NEXT: cmp {{.*}},0x0 181 ; CHECK-NEXT: cmp {{.*}},0x0
182 ; CHECK-NEXT: je 182 ; CHECK-NEXT: je
183 ; CHECK: cmp {{.*}},0x159 183 ; CHECK: cmp {{.*}},0x159
184 ; CHECK-NEXT: jne 184 ; CHECK-NEXT: jne
185 ; CHECK-NEXT: cmp {{.*}},0x0 185 ; CHECK-NEXT: cmp {{.*}},0x0
186 ; CHECK-NEXT: je 186 ; CHECK-NEXT: je
187 ; CHECK: cmp {{.*}},0x34567890 187 ; CHECK: cmp {{.*}},0x34567890
188 ; CHECK-NEXT: jne 188 ; CHECK-NEXT: jne
189 ; CHECK-NEXT: cmp {{.*}},0x12 189 ; CHECK-NEXT: cmp {{.*}},0x12
190 ; CHECK-NEXT: je 190 ; CHECK-NEXT: je
191
192 ; Test for correct 64-bit jump table with UINT64_MAX as one of the values.
193 ; TODO(ascull): this should generate a jump table
194 define internal i32 @testJumpTable64(i64 %a) {
195 entry:
196 switch i64 %a, label %sw.default [
197 i64 18446744073709551610, label %return
198 i64 18446744073709551612, label %sw.bb1
199 i64 18446744073709551613, label %sw.bb2
200 i64 18446744073709551615, label %sw.bb3
jvoung (off chromium) 2015/07/23 21:26:34 I think technically you could say "-1" also, if th
201 ]
202
203 sw.bb1:
204 br label %return
205
206 sw.bb2:
207 br label %return
208
209 sw.bb3:
210 br label %return
211
212 sw.default:
213 br label %return
214
215 return:
216 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ]
217 ret i32 %retval.0
218 }
jvoung (off chromium) 2015/07/23 21:26:34 Maybe move the "TODO" to the bottom here, add the
OLDNEW
« no previous file with comments | « src/IceSwitchLowering.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698