OLD | NEW |
1 ; Tests the branch optimizations under O2 (against a lack of | 1 ; Tests the branch optimizations under O2 (against a lack of |
2 ; optimizations under Om1). | 2 ; optimizations under Om1). |
3 | 3 |
4 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 4 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
5 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ | 5 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ |
6 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=O2 %s | 6 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=O2 %s |
7 | 7 |
8 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 8 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
9 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ | 9 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ |
10 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=OM1 %s | 10 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix=OM1 %s |
11 | 11 |
12 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 12 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
13 ; once enough infrastructure is in. Also, switch to --filetype=obj | 13 ; once enough infrastructure is in. Also, switch to --filetype=obj |
14 ; when possible. | 14 ; when possible. |
15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
16 ; RUN: --command %p2i --filetype=asm --assemble \ | 16 ; RUN: --command %p2i --filetype=asm --assemble \ |
17 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ | 17 ; RUN: --disassemble --target arm32 -i %s --args -O2 \ |
18 ; RUN: -allow-externally-defined-symbols \ | 18 ; RUN: -allow-externally-defined-symbols \ |
19 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 19 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
20 ; RUN: --command FileCheck --check-prefix ARM32O2 %s | 20 ; RUN: --command FileCheck --check-prefix ARM32O2 %s |
21 | 21 |
22 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 22 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
23 ; RUN: --command %p2i --filetype=asm --assemble \ | 23 ; RUN: --command %p2i --filetype=asm --assemble \ |
24 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ | 24 ; RUN: --disassemble --target arm32 -i %s --args -Om1 \ |
25 ; RUN: -allow-externally-defined-symbols \ | 25 ; RUN: -allow-externally-defined-symbols \ |
26 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 26 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
27 ; RUN: --command FileCheck \ | 27 ; RUN: --command FileCheck \ |
28 ; RUN: --check-prefix ARM32OM1 %s | 28 ; RUN: --check-prefix ARM32OM1 %s |
29 | 29 |
30 declare void @dummy() | 30 declare void @dummy() |
31 | 31 |
32 ; An unconditional branch to the next block should be removed. | 32 ; An unconditional branch to the next block should be removed. |
33 define internal void @testUncondToNextBlock() { | 33 define internal void @testUncondToNextBlock() { |
34 entry: | 34 entry: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ; OM1: jne | 88 ; OM1: jne |
89 ; OM1: jmp | 89 ; OM1: jmp |
90 ; OM1: call | 90 ; OM1: call |
91 ; OM1: ret | 91 ; OM1: ret |
92 ; OM1: call | 92 ; OM1: call |
93 ; OM1: ret | 93 ; OM1: ret |
94 | 94 |
95 ; Note that compare and branch folding isn't implemented yet (unlike x86-32). | 95 ; Note that compare and branch folding isn't implemented yet (unlike x86-32). |
96 ; ARM32O2-LABEL: testCondFallthroughToNextBlock | 96 ; ARM32O2-LABEL: testCondFallthroughToNextBlock |
97 ; ARM32O2: cmp {{.*}}, #123 | 97 ; ARM32O2: cmp {{.*}}, #123 |
98 ; ARM32O2-NEXT: movge {{.*}}, #1 | 98 ; ARM32O2-NEXT: bge |
99 ; ARM32O2-NEXT: uxtb | |
100 ; ARM32O2-NEXT: cmp {{.*}}, #0 | |
101 ; ARM32O2-NEXT: bne | |
102 ; ARM32O2-NEXT: bl | 99 ; ARM32O2-NEXT: bl |
103 ; ARM32O2: bx lr | 100 ; ARM32O2: bx lr |
104 ; ARM32O2: bl | 101 ; ARM32O2: bl |
105 ; ARM32O2: bx lr | 102 ; ARM32O2: bx lr |
106 | 103 |
107 ; ARM32OM1-LABEL: testCondFallthroughToNextBlock | 104 ; ARM32OM1-LABEL: testCondFallthroughToNextBlock |
108 ; ARM32OM1: cmp {{.*}}, #123 | 105 ; ARM32OM1: cmp {{.*}}, #123 |
109 ; ARM32OM1-NEXT: movge {{.*}}, #1 | 106 ; ARM32OM1: movlt {{.*}}, #0 |
| 107 ; ARM32OM1: movge {{.*}}, #1 |
110 ; ARM32OM1: cmp {{.*}}, #0 | 108 ; ARM32OM1: cmp {{.*}}, #0 |
111 ; ARM32OM1: bne | 109 ; ARM32OM1: bne |
112 ; ARM32OM1: b | 110 ; ARM32OM1: b |
113 ; ARM32OM1: bl | 111 ; ARM32OM1: bl |
114 ; ARM32OM1: bx lr | 112 ; ARM32OM1: bx lr |
115 ; ARM32OM1: bl | 113 ; ARM32OM1: bl |
116 ; ARM32OM1: bx lr | 114 ; ARM32OM1: bx lr |
117 | 115 |
118 ; For a conditional branch with the next block as the target and a | 116 ; For a conditional branch with the next block as the target and a |
119 ; different block as the fallthrough, the branch condition should be | 117 ; different block as the fallthrough, the branch condition should be |
(...skipping 27 matching lines...) Expand all Loading... |
147 ; OM1: jmp | 145 ; OM1: jmp |
148 ; OM1: call | 146 ; OM1: call |
149 ; OM1: ret | 147 ; OM1: ret |
150 ; OM1: call | 148 ; OM1: call |
151 ; OM1: ret | 149 ; OM1: ret |
152 | 150 |
153 ; Note that compare and branch folding isn't implemented yet | 151 ; Note that compare and branch folding isn't implemented yet |
154 ; (compared to x86-32). | 152 ; (compared to x86-32). |
155 ; ARM32O2-LABEL: testCondTargetNextBlock | 153 ; ARM32O2-LABEL: testCondTargetNextBlock |
156 ; ARM32O2: cmp {{.*}}, #123 | 154 ; ARM32O2: cmp {{.*}}, #123 |
157 ; ARM32O2-NEXT: movge {{.*}}, #1 | 155 ; ARM32O2-NEXT: blt |
158 ; ARM32O2-NEXT: uxtb | |
159 ; ARM32O2-NEXT: cmp {{.*}}, #0 | |
160 ; ARM32O2-NEXT: beq | |
161 ; ARM32O2-NEXT: bl | 156 ; ARM32O2-NEXT: bl |
162 ; ARM32O2: bx lr | 157 ; ARM32O2: bx lr |
163 ; ARM32O2: bl | 158 ; ARM32O2: bl |
164 ; ARM32O2: bx lr | 159 ; ARM32O2: bx lr |
165 | 160 |
166 ; ARM32OM1-LABEL: testCondTargetNextBlock | 161 ; ARM32OM1-LABEL: testCondTargetNextBlock |
167 ; ARM32OM1: cmp {{.*}}, #123 | 162 ; ARM32OM1: cmp {{.*}}, #123 |
168 ; ARM32OM1: movge {{.*}}, #1 | 163 ; ARM32OM1: movge {{.*}}, #1 |
169 ; ARM32OM1: cmp {{.*}}, #0 | 164 ; ARM32OM1: cmp {{.*}}, #0 |
170 ; ARM32OM1: bne | 165 ; ARM32OM1: bne |
(...skipping 29 matching lines...) Expand all Loading... |
200 ; OM1: call | 195 ; OM1: call |
201 | 196 |
202 ; ARM32O2-LABEL: testUncondToBlockAfterContract | 197 ; ARM32O2-LABEL: testUncondToBlockAfterContract |
203 ; ARM32O2: bl {{.*}} dummy | 198 ; ARM32O2: bl {{.*}} dummy |
204 ; ARM32O2-NEXT: bl {{.*}} dummy | 199 ; ARM32O2-NEXT: bl {{.*}} dummy |
205 | 200 |
206 ; ARM32OM1-LABEL: testUncondToBlockAfterContract | 201 ; ARM32OM1-LABEL: testUncondToBlockAfterContract |
207 ; ARM32OM1: bl {{.*}} dummy | 202 ; ARM32OM1: bl {{.*}} dummy |
208 ; ARM32OM1-NEXT: b | 203 ; ARM32OM1-NEXT: b |
209 ; ARM32OM1-NEXT: bl {{.*}} dummy | 204 ; ARM32OM1-NEXT: bl {{.*}} dummy |
OLD | NEW |