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

Side by Side Diff: tests_lit/llvm2ice_tests/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
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 ; For x86 see adv-switch-lowering.ll
Jim Stichnoth 2015/07/30 15:20:24 adv-switch-opt.ll
ascull 2015/07/30 17:30:00 Done.
6 6
7 ; TODO(jvoung): Update to -02 once the phi assignments is done for ARM 7 ; TODO(jvoung): Update to -02 once the phi assignments is done for ARM
8 ; RUN: %if --need=target_ARM32 --need=allow_dump \ 8 ; RUN: %if --need=target_ARM32 --need=allow_dump \
9 ; RUN: --command %p2i --filetype=asm --assemble --disassemble \ 9 ; RUN: --command %p2i --filetype=asm --assemble --disassemble \
10 ; RUN: --target arm32 -i %s --args -Om1 --skip-unimplemented \ 10 ; RUN: --target arm32 -i %s --args -Om1 --skip-unimplemented \
11 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ 11 ; RUN: | %if --need=target_ARM32 --need=allow_dump \
12 ; RUN: --command FileCheck --check-prefix ARM32 %s 12 ; RUN: --command FileCheck --check-prefix ARM32 %s
13 13
14 define i32 @testSwitch(i32 %a) { 14 define i32 @testSwitch(i32 %a) {
15 entry: 15 entry:
(...skipping 30 matching lines...) Expand all
46 ; register. 46 ; register.
47 define i32 @testSwitchImm() { 47 define i32 @testSwitchImm() {
48 entry: 48 entry:
49 switch i32 10, label %sw.default [ 49 switch i32 10, label %sw.default [
50 i32 1, label %sw.default 50 i32 1, label %sw.default
51 ] 51 ]
52 52
53 sw.default: 53 sw.default:
54 ret i32 20 54 ret i32 20
55 } 55 }
56 ; CHECK-LABEL: testSwitchImm
57 ; CHECK-NOT: cmp 0x{{[0-9a-f]*}},
58
59 ; ARM32-LABEL: testSwitchImm 56 ; ARM32-LABEL: testSwitchImm
60 ; ARM32: cmp {{r[0-9]+}}, #1 57 ; ARM32: cmp {{r[0-9]+}}, #1
61 ; ARM32-NEXT: beq 58 ; ARM32-NEXT: beq
62 ; ARM32-NEXT: b 59 ; ARM32-NEXT: b
63 60
64 ; Test for correct 64-bit lowering. 61 ; Test for correct 64-bit lowering.
65 define internal i32 @testSwitch64(i64 %a) { 62 define internal i32 @testSwitch64(i64 %a) {
66 entry: 63 entry:
67 switch i64 %a, label %sw.default [ 64 switch i64 %a, label %sw.default [
68 i64 123, label %return 65 i64 123, label %return
(...skipping 11 matching lines...) Expand all
80 sw.bb3: ; preds = %entry 77 sw.bb3: ; preds = %entry
81 br label %return 78 br label %return
82 79
83 sw.default: ; preds = %entry 80 sw.default: ; preds = %entry
84 br label %return 81 br label %return
85 82
86 return: ; preds = %sw.default, %sw.bb3 , %sw.bb2, %sw.bb1, %entry 83 return: ; preds = %sw.default, %sw.bb3 , %sw.bb2, %sw.bb1, %entry
87 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ] 84 %retval.0 = phi i32 [ 5, %sw.default ], [ 4, %sw.bb3 ], [ 3, %sw.bb2 ], [ 2, % sw.bb1 ], [ 1, %entry ]
88 ret i32 %retval.0 85 ret i32 %retval.0
89 } 86 }
90 ; CHECK-LABEL: testSwitch64
91 ; CHECK: cmp {{.*}},0x7b
92 ; CHECK-NEXT: jne
93 ; CHECK-NEXT: cmp {{.*}},0x0
94 ; CHECK-NEXT: je
95 ; CHECK: cmp {{.*}},0xea
96 ; CHECK-NEXT: jne
97 ; CHECK-NEXT: cmp {{.*}},0x0
98 ; CHECK-NEXT: je
99 ; CHECK: cmp {{.*}},0x159
100 ; CHECK-NEXT: jne
101 ; CHECK-NEXT: cmp {{.*}},0x0
102 ; CHECK-NEXT: je
103 ; CHECK: cmp {{.*}},0x34567890
104 ; CHECK-NEXT: jne
105 ; CHECK-NEXT: cmp {{.*}},0x12
106 ; CHECK-NEXT: je
107
108 ; ARM32-LABEL: testSwitch64 87 ; ARM32-LABEL: testSwitch64
109 ; ARM32: cmp {{r[0-9]+}}, #123 88 ; ARM32: cmp {{r[0-9]+}}, #123
110 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0 89 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
111 ; ARM32-NEXT: beq 90 ; ARM32-NEXT: beq
112 ; ARM32: cmp {{r[0-9]+}}, #234 91 ; ARM32: cmp {{r[0-9]+}}, #234
113 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0 92 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
114 ; ARM32-NEXT: beq 93 ; ARM32-NEXT: beq
115 ; ARM32: movw [[REG:r[0-9]+]], #345 94 ; ARM32: movw [[REG:r[0-9]+]], #345
116 ; ARM32-NEXT: cmp {{r[0-9]+}}, [[REG]] 95 ; ARM32-NEXT: cmp {{r[0-9]+}}, [[REG]]
117 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0 96 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
(...skipping 10 matching lines...) Expand all
128 ; assembler. 107 ; assembler.
129 define i32 @testSwitchImm64() { 108 define i32 @testSwitchImm64() {
130 entry: 109 entry:
131 switch i64 10, label %sw.default [ 110 switch i64 10, label %sw.default [
132 i64 1, label %sw.default 111 i64 1, label %sw.default
133 ] 112 ]
134 113
135 sw.default: 114 sw.default:
136 ret i32 20 115 ret i32 20
137 } 116 }
138 ; CHECK-LABEL: testSwitchImm64
139 ; CHECK: cmp {{.*}},0x1
140 ; CHECK-NEXT: jne
141 ; CHECK-NEXT: cmp {{.*}},0x0
142 ; CHECK-NEXT: je
143
144 ; ARM32-LABEL: testSwitchImm64 117 ; ARM32-LABEL: testSwitchImm64
145 ; ARM32: cmp {{r[0-9]+}}, #1 118 ; ARM32: cmp {{r[0-9]+}}, #1
146 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0 119 ; ARM32-NEXT: cmpeq {{r[0-9]+}}, #0
147 ; ARM32-NEXT: beq [[ADDR:[0-9a-f]+]] 120 ; ARM32-NEXT: beq [[ADDR:[0-9a-f]+]]
148 ; ARM32-NEXT: b [[ADDR]] 121 ; ARM32-NEXT: b [[ADDR]]
149 122
150 define i32 @testSwitchUndef64() { 123 define i32 @testSwitchUndef64() {
151 entry: 124 entry:
152 switch i64 undef, label %sw.default [ 125 switch i64 undef, label %sw.default [
153 i64 1, label %sw.default 126 i64 1, label %sw.default
154 ] 127 ]
155 128
156 sw.default: 129 sw.default:
157 ret i32 20 130 ret i32 20
158 } 131 }
159 ; CHECK-LABEL: testSwitchUndef64
160 ; CHECK: mov {{.*}},0x0
161 ; CHECK: mov {{.*}},0x0
162 ; ARM32-LABEL: testSwitchUndef64 132 ; ARM32-LABEL: testSwitchUndef64
163 ; ARM32: movw {{.*}}, #0 133 ; ARM32: movw {{.*}}, #0
164 ; ARM32: movw {{.*}}, #0 134 ; ARM32: movw {{.*}}, #0
OLDNEW
« src/IceTargetLoweringX86BaseImpl.h ('K') | « tests_lit/llvm2ice_tests/adv-switch-opt.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698