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 \ | 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 \ | 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 --skip-unimplemented \ |
| 18 ; RUN: -allow-externally-defined-symbols \ |
18 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 19 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
19 ; RUN: --command FileCheck --check-prefix ARM32O2 %s | 20 ; RUN: --command FileCheck --check-prefix ARM32O2 %s |
20 | 21 |
21 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 22 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
22 ; RUN: --command %p2i --filetype=asm --assemble \ | 23 ; RUN: --command %p2i --filetype=asm --assemble \ |
23 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ | 24 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ |
| 25 ; RUN: -allow-externally-defined-symbols \ |
24 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 26 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
25 ; RUN: --command FileCheck \ | 27 ; RUN: --command FileCheck \ |
26 ; RUN: --check-prefix ARM32OM1 %s | 28 ; RUN: --check-prefix ARM32OM1 %s |
27 | 29 |
28 declare void @dummy() | 30 declare void @dummy() |
29 | 31 |
30 ; An unconditional branch to the next block should be removed. | 32 ; An unconditional branch to the next block should be removed. |
31 define void @testUncondToNextBlock() { | 33 define internal void @testUncondToNextBlock() { |
32 entry: | 34 entry: |
33 call void @dummy() | 35 call void @dummy() |
34 br label %next | 36 br label %next |
35 next: | 37 next: |
36 call void @dummy() | 38 call void @dummy() |
37 ret void | 39 ret void |
38 } | 40 } |
39 ; O2-LABEL: testUncondToNextBlock | 41 ; O2-LABEL: testUncondToNextBlock |
40 ; O2: call | 42 ; O2: call |
41 ; There will be nops for bundle align to end (for NaCl), but there should | 43 ; There will be nops for bundle align to end (for NaCl), but there should |
(...skipping 10 matching lines...) Expand all Loading... |
52 ; ARM32O2: bl {{.*}} dummy | 54 ; ARM32O2: bl {{.*}} dummy |
53 ; ARM32O2-NEXT: bl {{.*}} dummy | 55 ; ARM32O2-NEXT: bl {{.*}} dummy |
54 | 56 |
55 ; ARM32OM1-LABEL: testUncondToNextBlock | 57 ; ARM32OM1-LABEL: testUncondToNextBlock |
56 ; ARM32OM1: bl {{.*}} dummy | 58 ; ARM32OM1: bl {{.*}} dummy |
57 ; ARM32OM1-NEXT: b | 59 ; ARM32OM1-NEXT: b |
58 ; ARM32OM1-NEXT: bl {{.*}} dummy | 60 ; ARM32OM1-NEXT: bl {{.*}} dummy |
59 | 61 |
60 ; For a conditional branch with a fallthrough to the next block, the | 62 ; For a conditional branch with a fallthrough to the next block, the |
61 ; fallthrough branch should be removed. | 63 ; fallthrough branch should be removed. |
62 define void @testCondFallthroughToNextBlock(i32 %arg) { | 64 define internal void @testCondFallthroughToNextBlock(i32 %arg) { |
63 entry: | 65 entry: |
64 %cmp = icmp sge i32 %arg, 123 | 66 %cmp = icmp sge i32 %arg, 123 |
65 br i1 %cmp, label %target, label %fallthrough | 67 br i1 %cmp, label %target, label %fallthrough |
66 fallthrough: | 68 fallthrough: |
67 call void @dummy() | 69 call void @dummy() |
68 ret void | 70 ret void |
69 target: | 71 target: |
70 call void @dummy() | 72 call void @dummy() |
71 ret void | 73 ret void |
72 } | 74 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 ; ARM32OM1: b | 111 ; ARM32OM1: b |
110 ; ARM32OM1: bl | 112 ; ARM32OM1: bl |
111 ; ARM32OM1: bx lr | 113 ; ARM32OM1: bx lr |
112 ; ARM32OM1: bl | 114 ; ARM32OM1: bl |
113 ; ARM32OM1: bx lr | 115 ; ARM32OM1: bx lr |
114 | 116 |
115 ; For a conditional branch with the next block as the target and a | 117 ; For a conditional branch with the next block as the target and a |
116 ; different block as the fallthrough, the branch condition should be | 118 ; different block as the fallthrough, the branch condition should be |
117 ; inverted, the fallthrough block changed to the target, and the | 119 ; inverted, the fallthrough block changed to the target, and the |
118 ; branch to the next block removed. | 120 ; branch to the next block removed. |
119 define void @testCondTargetNextBlock(i32 %arg) { | 121 define internal void @testCondTargetNextBlock(i32 %arg) { |
120 entry: | 122 entry: |
121 %cmp = icmp sge i32 %arg, 123 | 123 %cmp = icmp sge i32 %arg, 123 |
122 br i1 %cmp, label %fallthrough, label %target | 124 br i1 %cmp, label %fallthrough, label %target |
123 fallthrough: | 125 fallthrough: |
124 call void @dummy() | 126 call void @dummy() |
125 ret void | 127 ret void |
126 target: | 128 target: |
127 call void @dummy() | 129 call void @dummy() |
128 ret void | 130 ret void |
129 } | 131 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 ; ARM32OM1: cmp {{.*}}, #0 | 167 ; ARM32OM1: cmp {{.*}}, #0 |
166 ; ARM32OM1: bne | 168 ; ARM32OM1: bne |
167 ; ARM32OM1: b | 169 ; ARM32OM1: b |
168 ; ARM32OM1: bl | 170 ; ARM32OM1: bl |
169 ; ARM32OM1: bx lr | 171 ; ARM32OM1: bx lr |
170 ; ARM32OM1: bl | 172 ; ARM32OM1: bl |
171 ; ARM32OM1: bx lr | 173 ; ARM32OM1: bx lr |
172 | 174 |
173 ; Unconditional branches to the block after a contracted block should be | 175 ; Unconditional branches to the block after a contracted block should be |
174 ; removed. | 176 ; removed. |
175 define void @testUncondToBlockAfterContract() { | 177 define internal void @testUncondToBlockAfterContract() { |
176 entry: | 178 entry: |
177 call void @dummy() | 179 call void @dummy() |
178 br label %target | 180 br label %target |
179 contract: | 181 contract: |
180 br label %target | 182 br label %target |
181 target: | 183 target: |
182 call void @dummy() | 184 call void @dummy() |
183 ret void | 185 ret void |
184 } | 186 } |
185 | 187 |
(...skipping 10 matching lines...) Expand all Loading... |
196 ; OM1: call | 198 ; OM1: call |
197 | 199 |
198 ; ARM32O2-LABEL: testUncondToBlockAfterContract | 200 ; ARM32O2-LABEL: testUncondToBlockAfterContract |
199 ; ARM32O2: bl {{.*}} dummy | 201 ; ARM32O2: bl {{.*}} dummy |
200 ; ARM32O2-NEXT: bl {{.*}} dummy | 202 ; ARM32O2-NEXT: bl {{.*}} dummy |
201 | 203 |
202 ; ARM32OM1-LABEL: testUncondToBlockAfterContract | 204 ; ARM32OM1-LABEL: testUncondToBlockAfterContract |
203 ; ARM32OM1: bl {{.*}} dummy | 205 ; ARM32OM1: bl {{.*}} dummy |
204 ; ARM32OM1-NEXT: b | 206 ; ARM32OM1-NEXT: b |
205 ; ARM32OM1-NEXT: bl {{.*}} dummy | 207 ; ARM32OM1-NEXT: bl {{.*}} dummy |
OLD | NEW |