OLD | NEW |
1 ; This tests the optimization where producers and consumers of i1 (bool) | 1 ; This tests the optimization where producers and consumers of i1 (bool) |
2 ; variables are combined to implicitly use flags instead of explicitly using | 2 ; variables are combined to implicitly use flags instead of explicitly using |
3 ; stack or register variables. | 3 ; stack or register variables. |
4 | 4 |
5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ | 5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \ |
6 ; RUN: -allow-externally-defined-symbols | FileCheck %s | 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s |
7 | 7 |
8 ; RUN: %if --need=allow_dump --need=target_ARM32 --command %p2i --filetype=asm \ | 8 ; RUN: %if --need=allow_dump --need=target_ARM32 --command %p2i --filetype=asm \ |
9 ; RUN: --target arm32 -i %s --args -O2 --skip-unimplemented \ | 9 ; RUN: --target arm32 -i %s --args -O2 --skip-unimplemented \ |
10 ; RUN: -allow-externally-defined-symbols \ | 10 ; RUN: -allow-externally-defined-symbols \ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ret i32 2 | 48 ret i32 2 |
49 } | 49 } |
50 | 50 |
51 ; CHECK-LABEL: fold_cmp_br_intervening_insts | 51 ; CHECK-LABEL: fold_cmp_br_intervening_insts |
52 ; CHECK-NOT: cmp | 52 ; CHECK-NOT: cmp |
53 ; CHECK: call | 53 ; CHECK: call |
54 ; CHECK: cmp | 54 ; CHECK: cmp |
55 ; CHECK: jge | 55 ; CHECK: jge |
56 ; ARM32-LABEL: fold_cmp_br_intervening_insts | 56 ; ARM32-LABEL: fold_cmp_br_intervening_insts |
57 ; ARM32: push {{[{].*[}]}} | 57 ; ARM32: push {{[{].*[}]}} |
58 ; ARM32: bl use_value | 58 ; ARM32: movw [[CALL:r[0-9]]], #:lower16:use_value |
| 59 ; ARM32: movt [[CALL]], #:upper16:use_value |
| 60 ; ARM32: blx [[CALL]] |
59 ; ARM32: cmp {{r[0-9]+}}, {{r[0-9]+}} | 61 ; ARM32: cmp {{r[0-9]+}}, {{r[0-9]+}} |
60 ; ARM32: bge | 62 ; ARM32: bge |
61 ; ARM32: mov r0, #1 | 63 ; ARM32: mov r0, #1 |
62 ; ARM32: bx lr | 64 ; ARM32: bx lr |
63 ; ARM32: mov r0, #2 | 65 ; ARM32: mov r0, #2 |
64 ; ARM32: bx lr | 66 ; ARM32: bx lr |
65 | 67 |
66 | 68 |
67 ; Cmp/branch non-folding because of live-out. | 69 ; Cmp/branch non-folding because of live-out. |
68 define internal i32 @no_fold_cmp_br_liveout(i32 %arg1, i32 %arg2) { | 70 define internal i32 @no_fold_cmp_br_liveout(i32 %arg1, i32 %arg2) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 %result = select i1 %cmp1, i32 %arg1, i32 %arg2 | 185 %result = select i1 %cmp1, i32 %arg1, i32 %arg2 |
184 ret i32 %result | 186 ret i32 %result |
185 } | 187 } |
186 | 188 |
187 ; CHECK-LABEL: fold_cmp_select_intervening_insts | 189 ; CHECK-LABEL: fold_cmp_select_intervening_insts |
188 ; CHECK-NOT: cmp | 190 ; CHECK-NOT: cmp |
189 ; CHECK: call | 191 ; CHECK: call |
190 ; CHECK: cmp | 192 ; CHECK: cmp |
191 ; CHECK: cmovl | 193 ; CHECK: cmovl |
192 ; ARM32-LABEL: fold_cmp_select_intervening_insts | 194 ; ARM32-LABEL: fold_cmp_select_intervening_insts |
193 ; ARM32: bl use_value | 195 ; ARM32: movw [[CALL:r[0-9]]], #:lower16:use_value |
| 196 ; ARM32: movt [[CALL]], #:upper16:use_value |
| 197 ; ARM32: blx [[CALL]] |
194 ; ARM32: cmp r{{[0-9]+}}, r{{[0-9]+}} | 198 ; ARM32: cmp r{{[0-9]+}}, r{{[0-9]+}} |
195 ; ARM32: movlt | 199 ; ARM32: movlt |
196 ; ARM32: bx lr | 200 ; ARM32: bx lr |
197 | 201 |
198 ; Cmp/multi-select folding. | 202 ; Cmp/multi-select folding. |
199 define internal i32 @fold_cmp_select_multi(i32 %arg1, i32 %arg2) { | 203 define internal i32 @fold_cmp_select_multi(i32 %arg1, i32 %arg2) { |
200 entry: | 204 entry: |
201 %cmp1 = icmp slt i32 %arg1, %arg2 | 205 %cmp1 = icmp slt i32 %arg1, %arg2 |
202 %a = select i1 %cmp1, i32 %arg1, i32 %arg2 | 206 %a = select i1 %cmp1, i32 %arg1, i32 %arg2 |
203 %b = select i1 %cmp1, i32 %arg2, i32 %arg1 | 207 %b = select i1 %cmp1, i32 %arg2, i32 %arg1 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 ; ARM32: tst r0, #1 | 424 ; ARM32: tst r0, #1 |
421 ; ARM32: bne | 425 ; ARM32: bne |
422 ; ARM32: tst r1, #1 | 426 ; ARM32: tst r1, #1 |
423 ; ARM32: beq | 427 ; ARM32: beq |
424 ; ARM32: tst r2, #1 | 428 ; ARM32: tst r2, #1 |
425 ; ARM32: bne {{.*}}target_true | 429 ; ARM32: bne {{.*}}target_true |
426 ; ARM32: tst r3, #1 | 430 ; ARM32: tst r3, #1 |
427 ; ARM32: beq {{.*}}target_false | 431 ; ARM32: beq {{.*}}target_false |
428 ; ARM32: tst r4, #1 | 432 ; ARM32: tst r4, #1 |
429 ; ARM32: beq {{.*}}target_false | 433 ; ARM32: beq {{.*}}target_false |
OLD | NEW |