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

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

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 11 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/IceTargetLoweringX86BaseImpl.h ('k') | tests_lit/llvm2ice_tests/nonsfi.ll » ('j') | 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: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s
5 5
6 ; Dense but non-continuous ranges should be converted into a jump table. 6 ; Dense but non-continuous ranges should be converted into a jump table.
7 define internal i32 @testJumpTable(i32 %a) { 7 define internal i32 @testJumpTable(i32 %a) {
8 entry: 8 entry:
9 switch i32 %a, label %sw.default [ 9 switch i32 %a, label %sw.default [
10 i32 91, label %sw.default 10 i32 91, label %sw.default
(...skipping 14 matching lines...) Expand all
25 br label %sw.epilog 25 br label %sw.epilog
26 26
27 sw.epilog: 27 sw.epilog:
28 %result.1 = phi i32 [ %add, %sw.default ], [ %tmp, %sw.bb1 ], [ 17, %entry ] 28 %result.1 = phi i32 [ %add, %sw.default ], [ %tmp, %sw.bb1 ], [ 17, %entry ]
29 ret i32 %result.1 29 ret i32 %result.1
30 } 30 }
31 ; CHECK-LABEL: testJumpTable 31 ; CHECK-LABEL: testJumpTable
32 ; CHECK: sub [[IND:[^,]+]],0x5b 32 ; CHECK: sub [[IND:[^,]+]],0x5b
33 ; CHECK-NEXT: cmp [[IND]],0x8 33 ; CHECK-NEXT: cmp [[IND]],0x8
34 ; CHECK-NEXT: ja 34 ; CHECK-NEXT: ja
35 ; CHECK-NEXT: mov [[BASE:[^,]+]],0x0 {{[0-9a-f]+}}: R_386_32 .{{.*}}testJumpTabl e$jumptable 35 ; CHECK-NEXT: mov [[TARGET:.*]],DWORD PTR {{\[}}[[IND]]*4+0x0] {{[0-9a-f]+}}: R_ 386_32 .{{.*}}testJumpTable$jumptable
36 ; CHECK-NEXT: mov {{.*}},DWORD PTR {{\[}}[[BASE]]+[[IND]]*4] 36 ; CHECK-NEXT: jmp [[TARGET]]
37 ; CHECK-NEXT: jmp
38 37
39 ; Continuous ranges which map to the same target should be grouped and 38 ; Continuous ranges which map to the same target should be grouped and
40 ; efficiently tested. 39 ; efficiently tested.
41 define internal i32 @testRangeTest() { 40 define internal i32 @testRangeTest() {
42 entry: 41 entry:
43 switch i32 10, label %sw.default [ 42 switch i32 10, label %sw.default [
44 i32 0, label %sw.epilog 43 i32 0, label %sw.epilog
45 i32 1, label %sw.epilog 44 i32 1, label %sw.epilog
46 i32 2, label %sw.epilog 45 i32 2, label %sw.epilog
47 i32 3, label %sw.epilog 46 i32 3, label %sw.epilog
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 sw.default: 209 sw.default:
211 br label %return 210 br label %return
212 211
213 return: 212 return:
214 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ] 213 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ]
215 ret i32 %retval.0 214 ret i32 %retval.0
216 } 215 }
217 216
218 ; TODO(ascull): this should generate a jump table. For now, just make sure it 217 ; TODO(ascull): this should generate a jump table. For now, just make sure it
219 ; doesn't crash the compiler. 218 ; doesn't crash the compiler.
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX86BaseImpl.h ('k') | tests_lit/llvm2ice_tests/nonsfi.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698