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

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

Issue 1213593002: Implement ARM32 switch lowering. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add TODOs for jvoung suggested in review Created 5 years, 5 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/IceTargetLoweringARM32.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 a switch statement, including multiple branches to the 1 ; This tests a switch statement, including multiple branches to the
2 ; same label which also results in phi instructions with multiple 2 ; same label which also results in phi instructions with multiple
3 ; entries for the same incoming edge. 3 ; entries for the same incoming edge.
4 4
5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s 5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s
6 6
7 ; TODO(jvoung): Update to -02 once the phi assignments is done for ARM
8 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=asm --assemble \
9 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \
10 ; RUN: | %if --need=target_ARM32 --command FileCheck --check-prefix ARM32 %s
11
7 define i32 @testSwitch(i32 %a) { 12 define i32 @testSwitch(i32 %a) {
8 entry: 13 entry:
9 switch i32 %a, label %sw.default [ 14 switch i32 %a, label %sw.default [
10 i32 1, label %sw.epilog 15 i32 1, label %sw.epilog
11 i32 2, label %sw.epilog 16 i32 2, label %sw.epilog
12 i32 3, label %sw.epilog 17 i32 3, label %sw.epilog
13 i32 7, label %sw.bb1 18 i32 7, label %sw.bb1
14 i32 8, label %sw.bb1 19 i32 8, label %sw.bb1
15 i32 15, label %sw.bb2 20 i32 15, label %sw.bb2
16 i32 14, label %sw.bb2 21 i32 14, label %sw.bb2
(...skipping 25 matching lines...) Expand all
42 switch i32 10, label %sw.default [ 47 switch i32 10, label %sw.default [
43 i32 1, label %sw.default 48 i32 1, label %sw.default
44 ] 49 ]
45 50
46 sw.default: 51 sw.default:
47 ret i32 20 52 ret i32 20
48 } 53 }
49 ; CHECK-LABEL: testSwitchImm 54 ; CHECK-LABEL: testSwitchImm
50 ; CHECK-NOT: cmp 0x{{[0-9a-f]*}}, 55 ; CHECK-NOT: cmp 0x{{[0-9a-f]*}},
51 56
57 ; ARM32-LABEL: testSwitchImm
58 ; ARM32: cmp {{r[0-9]+}}, #1
59 ; ARM32-NEXT: beq
60 ; ARM32-NEXT: b
61
52 ; Test for correct 64-bit lowering. 62 ; Test for correct 64-bit lowering.
53 define internal i32 @testSwitch64(i64 %a) { 63 define internal i32 @testSwitch64(i64 %a) {
54 entry: 64 entry:
55 switch i64 %a, label %sw.default [ 65 switch i64 %a, label %sw.default [
56 i64 123, label %return 66 i64 123, label %return
57 i64 234, label %sw.bb1 67 i64 234, label %sw.bb1
58 i64 345, label %sw.bb2 68 i64 345, label %sw.bb2
59 i64 78187493520, label %sw.bb3 69 i64 78187493520, label %sw.bb3
60 ] 70 ]
61 71
(...skipping 24 matching lines...) Expand all
86 ; CHECK-NEXT: je 96 ; CHECK-NEXT: je
87 ; CHECK: cmp {{.*}},0x159 97 ; CHECK: cmp {{.*}},0x159
88 ; CHECK-NEXT: jne 98 ; CHECK-NEXT: jne
89 ; CHECK-NEXT: cmp {{.*}},0x0 99 ; CHECK-NEXT: cmp {{.*}},0x0
90 ; CHECK-NEXT: je 100 ; CHECK-NEXT: je
91 ; CHECK: cmp {{.*}},0x34567890 101 ; CHECK: cmp {{.*}},0x34567890
92 ; CHECK-NEXT: jne 102 ; CHECK-NEXT: jne
93 ; CHECK-NEXT: cmp {{.*}},0x12 103 ; CHECK-NEXT: cmp {{.*}},0x12
94 ; CHECK-NEXT: je 104 ; CHECK-NEXT: je
95 105
106 ; ARM32-LABEL: testSwitch64
107 ; ARM32: cmp {{r[0-9]+}}, #123
108 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
109 ; ARM32-NEXT: beq
110 ; ARM32: cmp {{r[0-9]+}}, #234
111 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
112 ; ARM32-NEXT: beq
113 ; ARM32: movw [[REG:r[0-9]+]], #345
114 ; ARM32-NEXT: cmp {{r[0-9]+}}, [[REG]]
115 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
116 ; ARM32-NEXT: beq
117 ; ARM32: movw [[REG:r[0-9]+]], #30864
118 ; ARM32-NEXT: movt [[REG]], #13398
119 ; ARM32-NEXT: cmp {{r[0-9]+}}, [[REG]]
120 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #18
121 ; ARM32-NEXT: beq
122 ; ARM32-NEXT: b
123
96 ; Similar to testSwitchImm, make sure proper addressing modes are 124 ; Similar to testSwitchImm, make sure proper addressing modes are
97 ; used. In reality, this is tested by running the output through the 125 ; used. In reality, this is tested by running the output through the
98 ; assembler. 126 ; assembler.
99 define i32 @testSwitchImm64() { 127 define i32 @testSwitchImm64() {
100 entry: 128 entry:
101 switch i64 10, label %sw.default [ 129 switch i64 10, label %sw.default [
102 i64 1, label %sw.default 130 i64 1, label %sw.default
103 ] 131 ]
104 132
105 sw.default: 133 sw.default:
106 ret i32 20 134 ret i32 20
107 } 135 }
108 ; CHECK-LABEL: testSwitchImm64 136 ; CHECK-LABEL: testSwitchImm64
109 ; CHECK: cmp {{.*}},0x1 137 ; CHECK: cmp {{.*}},0x1
110 ; CHECK-NEXT: jne 138 ; CHECK-NEXT: jne
111 ; CHECK-NEXT: cmp {{.*}},0x0 139 ; CHECK-NEXT: cmp {{.*}},0x0
112 ; CHECK-NEXT: je 140 ; CHECK-NEXT: je
141
142 ; ARM32-LABEL: testSwitchImm64
143 ; ARM32: cmp {{r[0-9]+}}, #1
144 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
145 ; ARM32-NEXT: beq [[ADDR:[0-9a-f]+]]
146 ; ARM32-NEXT: b [[ADDR]]
147
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698