Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 1 | ; Simple test of the select instruction. The CHECK lines are only |
| 2 | ; checking for basic instruction patterns that should be present |
| 3 | ; regardless of the optimization level, so there are no special OPTM1 |
| 4 | ; match lines. |
| 5 | |
Jim Stichnoth | d97c7df | 2014-06-04 11:57:08 -0700 | [diff] [blame] | 6 | ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 7 | ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s |
Matt Wala | 927cc17 | 2014-07-22 15:03:01 -0700 | [diff] [blame] | 8 | ; RUN: %llvm2ice -O2 --verbose none %s | llvm-mc -x86-asm-syntax=intel |
| 9 | ; RUN: %llvm2ice -Om1 --verbose none %s | llvm-mc -x86-asm-syntax=intel |
Jim Stichnoth | 5bc2b1d | 2014-05-22 13:38:48 -0700 | [diff] [blame] | 10 | ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
Karl Schimpf | a667fb8 | 2014-05-19 14:56:51 -0700 | [diff] [blame] | 11 | ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 12 | ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 13 | ; RUN: | FileCheck --check-prefix=DUMP %s |
Jim Stichnoth | f7c9a14 | 2014-04-29 10:52:43 -0700 | [diff] [blame] | 14 | |
| 15 | define void @testSelect(i32 %a, i32 %b) { |
| 16 | entry: |
| 17 | %cmp = icmp slt i32 %a, %b |
| 18 | %cond = select i1 %cmp, i32 %a, i32 %b |
| 19 | tail call void @useInt(i32 %cond) |
| 20 | %cmp1 = icmp sgt i32 %a, %b |
| 21 | %cond2 = select i1 %cmp1, i32 10, i32 20 |
| 22 | tail call void @useInt(i32 %cond2) |
| 23 | ret void |
| 24 | } |
| 25 | |
| 26 | declare void @useInt(i32) |
| 27 | |
| 28 | ; CHECK: .globl testSelect |
| 29 | ; CHECK: cmp |
| 30 | ; CHECK: cmp |
| 31 | ; CHECK: call useInt |
| 32 | ; CHECK: cmp |
| 33 | ; CHECK: cmp |
| 34 | ; CHECK: call useInt |
| 35 | ; CHECK: ret |
| 36 | |
| 37 | ; ERRORS-NOT: ICE translation error |
| 38 | ; DUMP-NOT: SZ |