| 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: %llvm2ice -O2 --verbose none %s | FileCheck %s | |
| 7 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s | |
| 8 ; RUN: %llvm2ice -O2 --verbose none %s \ | 6 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 9 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 7 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 8 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 10 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 9 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
| 11 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 10 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
| 11 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
| 12 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 12 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 13 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 13 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 14 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 14 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 15 ; RUN: | FileCheck --check-prefix=DUMP %s | 15 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 16 | 16 |
| 17 define void @testSelect(i32 %a, i32 %b) { | 17 define void @testSelect(i32 %a, i32 %b) { |
| 18 entry: | 18 entry: |
| 19 %cmp = icmp slt i32 %a, %b | 19 %cmp = icmp slt i32 %a, %b |
| 20 %cond = select i1 %cmp, i32 %a, i32 %b | 20 %cond = select i1 %cmp, i32 %a, i32 %b |
| 21 tail call void @useInt(i32 %cond) | 21 tail call void @useInt(i32 %cond) |
| 22 %cmp1 = icmp sgt i32 %a, %b | 22 %cmp1 = icmp sgt i32 %a, %b |
| 23 %cond2 = select i1 %cmp1, i32 10, i32 20 | 23 %cond2 = select i1 %cmp1, i32 10, i32 20 |
| 24 tail call void @useInt(i32 %cond2) | 24 tail call void @useInt(i32 %cond2) |
| 25 ret void | 25 ret void |
| 26 } | 26 } |
| 27 | 27 |
| 28 declare void @useInt(i32) | 28 define void @useInt(i32 %x) { |
| 29 entry: |
| 30 call void @useIntHelper(i32 %x) |
| 31 ret void |
| 32 } |
| 29 | 33 |
| 30 ; CHECK: .globl testSelect | 34 declare void @useIntHelper(i32) |
| 35 |
| 36 ; CHECK-LABEL: testSelect |
| 31 ; CHECK: cmp | 37 ; CHECK: cmp |
| 32 ; CHECK: cmp | 38 ; CHECK: cmp |
| 33 ; CHECK: call useInt | 39 ; CHECK: call useInt |
| 34 ; CHECK: cmp | 40 ; CHECK: cmp |
| 35 ; CHECK: cmp | 41 ; CHECK: cmp |
| 36 ; CHECK: call useInt | 42 ; CHECK: call useInt |
| 37 ; CHECK: ret | |
| 38 | 43 |
| 39 ; Check for valid addressing mode in the cmp instruction when the | 44 ; Check for valid addressing mode in the cmp instruction when the |
| 40 ; operand is an immediate. | 45 ; operand is an immediate. |
| 41 define i32 @testSelectImm32(i32 %a, i32 %b) { | 46 define i32 @testSelectImm32(i32 %a, i32 %b) { |
| 42 entry: | 47 entry: |
| 43 %cond = select i1 0, i32 %a, i32 %b | 48 %cond = select i1 0, i32 %a, i32 %b |
| 44 ret i32 %cond | 49 ret i32 %cond |
| 45 } | 50 } |
| 46 ; CHECK-LABEL: testSelectImm32 | 51 ; CHECK-LABEL: testSelectImm32 |
| 47 ; CHECK-NOT: cmp {{[0-9]+}}, | 52 ; CHECK-NOT: cmp {{[0-9]+}}, |
| 48 | 53 |
| 49 ; Check for valid addressing mode in the cmp instruction when the | 54 ; Check for valid addressing mode in the cmp instruction when the |
| 50 ; operand is an immediate. There is a different x86-32 lowering | 55 ; operand is an immediate. There is a different x86-32 lowering |
| 51 ; sequence for 64-bit operands. | 56 ; sequence for 64-bit operands. |
| 52 define i64 @testSelectImm64(i64 %a, i64 %b) { | 57 define i64 @testSelectImm64(i64 %a, i64 %b) { |
| 53 entry: | 58 entry: |
| 54 %cond = select i1 1, i64 %a, i64 %b | 59 %cond = select i1 1, i64 %a, i64 %b |
| 55 ret i64 %cond | 60 ret i64 %cond |
| 56 } | 61 } |
| 57 ; CHECK-LABEL: testSelectImm64 | 62 ; CHECK-LABEL: testSelectImm64 |
| 58 ; CHECK-NOT: cmp {{[0-9]+}}, | 63 ; CHECK-NOT: cmp {{[0-9]+}}, |
| 59 | 64 |
| 60 ; ERRORS-NOT: ICE translation error | 65 ; ERRORS-NOT: ICE translation error |
| 61 ; DUMP-NOT: SZ | 66 ; DUMP-NOT: SZ |
| OLD | NEW |