| OLD | NEW |
| 1 ; Simple test of the select instruction. The CHECK lines are only | 1 ; Simple test of the select instruction. The CHECK lines are only |
| 2 ; checking for basic instruction patterns that should be present | 2 ; checking for basic instruction patterns that should be present |
| 3 ; regardless of the optimization level, so there are no special OPTM1 | 3 ; regardless of the optimization level, so there are no special OPTM1 |
| 4 ; match lines. | 4 ; match lines. |
| 5 | 5 |
| 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 7 ; RUN: --target x8632 -i %s --args -O2 \ | 7 ; RUN: --target x8632 -i %s --args -O2 -allow-externally-defined-symbols \ |
| 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 10 ; RUN: --target x8632 -i %s --args -Om1 \ | 10 ; RUN: --target x8632 -i %s --args -Om1 -allow-externally-defined-symbols \ |
| 11 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 11 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 12 | 12 |
| 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| 14 ; RUN: --command %p2i --filetype=asm --assemble \ | 14 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 15 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ | 15 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ |
| 16 ; RUN: -allow-externally-defined-symbols \ |
| 16 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 17 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
| 17 ; RUN: --command FileCheck --check-prefix ARM32 %s | 18 ; RUN: --command FileCheck --check-prefix ARM32 %s |
| 18 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 19 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| 19 ; RUN: --command %p2i --filetype=asm --assemble \ | 20 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 20 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ | 21 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ |
| 22 ; RUN: -allow-externally-defined-symbols \ |
| 21 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 23 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
| 22 ; RUN: --command FileCheck --check-prefix ARM32 %s | 24 ; RUN: --command FileCheck --check-prefix ARM32 %s |
| 23 | 25 |
| 24 define void @testSelect(i32 %a, i32 %b) { | 26 define internal void @testSelect(i32 %a, i32 %b) { |
| 25 entry: | 27 entry: |
| 26 %cmp = icmp slt i32 %a, %b | 28 %cmp = icmp slt i32 %a, %b |
| 27 %cond = select i1 %cmp, i32 %a, i32 %b | 29 %cond = select i1 %cmp, i32 %a, i32 %b |
| 28 tail call void @useInt(i32 %cond) | 30 tail call void @useInt(i32 %cond) |
| 29 %cmp1 = icmp sgt i32 %a, %b | 31 %cmp1 = icmp sgt i32 %a, %b |
| 30 %cond2 = select i1 %cmp1, i32 10, i32 20 | 32 %cond2 = select i1 %cmp1, i32 10, i32 20 |
| 31 tail call void @useInt(i32 %cond2) | 33 tail call void @useInt(i32 %cond2) |
| 32 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding. | 34 ; Create "fake" uses of %cmp and %cmp1 to prevent O2 bool folding. |
| 33 %d1 = zext i1 %cmp to i32 | 35 %d1 = zext i1 %cmp to i32 |
| 34 call void @useInt(i32 %d1) | 36 call void @useInt(i32 %d1) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 ; ARM32: bl {{.*}} useInt | 55 ; ARM32: bl {{.*}} useInt |
| 54 ; ARM32: cmp | 56 ; ARM32: cmp |
| 55 ; ARM32: cmp | 57 ; ARM32: cmp |
| 56 ; ARM32: mov {{.*}}, #20 | 58 ; ARM32: mov {{.*}}, #20 |
| 57 ; ARM32: movne {{.*}}, #10 | 59 ; ARM32: movne {{.*}}, #10 |
| 58 ; ARM32: bl {{.*}} useInt | 60 ; ARM32: bl {{.*}} useInt |
| 59 ; ARM32: bx lr | 61 ; ARM32: bx lr |
| 60 | 62 |
| 61 ; Check for valid addressing mode in the cmp instruction when the | 63 ; Check for valid addressing mode in the cmp instruction when the |
| 62 ; operand is an immediate. | 64 ; operand is an immediate. |
| 63 define i32 @testSelectImm32(i32 %a, i32 %b) { | 65 define internal i32 @testSelectImm32(i32 %a, i32 %b) { |
| 64 entry: | 66 entry: |
| 65 %cond = select i1 false, i32 %a, i32 %b | 67 %cond = select i1 false, i32 %a, i32 %b |
| 66 ret i32 %cond | 68 ret i32 %cond |
| 67 } | 69 } |
| 68 ; CHECK-LABEL: testSelectImm32 | 70 ; CHECK-LABEL: testSelectImm32 |
| 69 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, | 71 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, |
| 70 ; ARM32-LABEL: testSelectImm32 | 72 ; ARM32-LABEL: testSelectImm32 |
| 71 ; ARM32-NOT: cmp #{{.*}}, | 73 ; ARM32-NOT: cmp #{{.*}}, |
| 72 | 74 |
| 73 ; Check for valid addressing mode in the cmp instruction when the | 75 ; Check for valid addressing mode in the cmp instruction when the |
| 74 ; operand is an immediate. There is a different x86-32 lowering | 76 ; operand is an immediate. There is a different x86-32 lowering |
| 75 ; sequence for 64-bit operands. | 77 ; sequence for 64-bit operands. |
| 76 define i64 @testSelectImm64(i64 %a, i64 %b) { | 78 define internal i64 @testSelectImm64(i64 %a, i64 %b) { |
| 77 entry: | 79 entry: |
| 78 %cond = select i1 true, i64 %a, i64 %b | 80 %cond = select i1 true, i64 %a, i64 %b |
| 79 ret i64 %cond | 81 ret i64 %cond |
| 80 } | 82 } |
| 81 ; CHECK-LABEL: testSelectImm64 | 83 ; CHECK-LABEL: testSelectImm64 |
| 82 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, | 84 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, |
| 83 ; ARM32-LABEL: testSelectImm64 | 85 ; ARM32-LABEL: testSelectImm64 |
| 84 ; ARM32-NOT: cmp #{{.*}}, | 86 ; ARM32-NOT: cmp #{{.*}}, |
| OLD | NEW |