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

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

Issue 1257283004: Iasm and obj lowering for advanced 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
« src/IceSwitchLowering.h ('K') | « src/IceTargetLoweringX86BaseImpl.h ('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: %p2i -i %s --assemble --disassemble --args --adv-switch -O2 \
5 ; RUN: --disassemble --args --adv-switch -O2 | FileCheck %s 5 ; RUN: | 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 [
11 i32 91, label %sw.default 11 i32 91, label %sw.default
12 i32 92, label %sw.bb1 12 i32 92, label %sw.bb1
13 i32 93, label %sw.default 13 i32 93, label %sw.default
14 i32 99, label %sw.bb1 14 i32 99, label %sw.bb1
15 i32 98, label %sw.default 15 i32 98, label %sw.default
(...skipping 10 matching lines...) Expand all
26 br label %sw.epilog 26 br label %sw.epilog
27 27
28 sw.epilog: 28 sw.epilog:
29 %result.1 = phi i32 [ %add, %sw.default ], [ %tmp, %sw.bb1 ], [ 17, %entry ] 29 %result.1 = phi i32 [ %add, %sw.default ], [ %tmp, %sw.bb1 ], [ 17, %entry ]
30 ret i32 %result.1 30 ret i32 %result.1
31 } 31 }
32 ; CHECK-LABEL: testJumpTable 32 ; CHECK-LABEL: testJumpTable
33 ; CHECK: sub [[IND:[^,]+]],0x5b 33 ; CHECK: sub [[IND:[^,]+]],0x5b
34 ; CHECK-NEXT: cmp [[IND]],0x8 34 ; CHECK-NEXT: cmp [[IND]],0x8
35 ; CHECK-NEXT: ja 35 ; CHECK-NEXT: ja
36 ; CHECK-NEXT: mov [[BASE:[^,]+]],0x0 {{[0-9a-f]+}}: R_386_32 .rodata.testJumpTab le$jumptable 36 ; CHECK-NEXT: mov [[BASE:[^,]+]],0x0 {{[0-9a-f]+}}: R_386_32 .{{.*}}testJumpTabl e$jumptable
37 ; CHECK-NEXT: mov {{.*}},DWORD PTR {{\[}}[[BASE]]+[[IND]]*4] 37 ; CHECK-NEXT: mov {{.*}},DWORD PTR {{\[}}[[BASE]]+[[IND]]*4]
38 ; CHECK-NEXT: jmp 38 ; CHECK-NEXT: jmp
39 39
40 ; Continuous ranges which map to the same target should be grouped and 40 ; Continuous ranges which map to the same target should be grouped and
41 ; efficiently tested. 41 ; efficiently tested.
42 define internal i32 @testRangeTest() { 42 define internal i32 @testRangeTest() {
43 entry: 43 entry:
44 switch i32 10, label %sw.default [ 44 switch i32 10, label %sw.default [
45 i32 0, label %sw.epilog 45 i32 0, label %sw.epilog
46 i32 1, label %sw.epilog 46 i32 1, label %sw.epilog
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 sw.default: 211 sw.default:
212 br label %return 212 br label %return
213 213
214 return: 214 return:
215 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ] 215 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ]
216 ret i32 %retval.0 216 ret i32 %retval.0
217 } 217 }
218 218
219 ; TODO(ascull): this should generate a jump table. For now, just make sure it 219 ; TODO(ascull): this should generate a jump table. For now, just make sure it
220 ; doesn't crash the compiler. 220 ; doesn't crash the compiler.
OLDNEW
« src/IceSwitchLowering.h ('K') | « src/IceTargetLoweringX86BaseImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698