Juergen Ributzka | d1a042a | 2014-11-13 00:36:38 +0000 | [diff] [blame^] | 1 | ; RUN: llc -mtriple=aarch64-apple-darwin -verify-machineinstrs < %s | FileCheck %s |
| 2 | ; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -fast-isel-abort -verify-machineinstrs < %s | FileCheck %s |
| 3 | |
| 4 | ; First test the different supported value types for select. |
| 5 | define zeroext i1 @select_i1(i1 zeroext %c, i1 zeroext %a, i1 zeroext %b) { |
| 6 | ; CHECK-LABEL: select_i1 |
| 7 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 8 | ; CHECK-NEXT: csel {{w[0-9]+}}, w1, w2, ne |
| 9 | %1 = select i1 %c, i1 %a, i1 %b |
| 10 | ret i1 %1 |
| 11 | } |
| 12 | |
| 13 | define zeroext i8 @select_i8(i1 zeroext %c, i8 zeroext %a, i8 zeroext %b) { |
| 14 | ; CHECK-LABEL: select_i8 |
| 15 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 16 | ; CHECK-NEXT: csel {{w[0-9]+}}, w1, w2, ne |
| 17 | %1 = select i1 %c, i8 %a, i8 %b |
| 18 | ret i8 %1 |
| 19 | } |
| 20 | |
| 21 | define zeroext i16 @select_i16(i1 zeroext %c, i16 zeroext %a, i16 zeroext %b) { |
| 22 | ; CHECK-LABEL: select_i16 |
| 23 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 24 | ; CHECK-NEXT: csel {{w[0-9]+}}, w1, w2, ne |
| 25 | %1 = select i1 %c, i16 %a, i16 %b |
| 26 | ret i16 %1 |
| 27 | } |
| 28 | |
| 29 | define i32 @select_i32(i1 zeroext %c, i32 %a, i32 %b) { |
| 30 | ; CHECK-LABEL: select_i32 |
| 31 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 32 | ; CHECK-NEXT: csel {{w[0-9]+}}, w1, w2, ne |
| 33 | %1 = select i1 %c, i32 %a, i32 %b |
| 34 | ret i32 %1 |
| 35 | } |
| 36 | |
| 37 | define i64 @select_i64(i1 zeroext %c, i64 %a, i64 %b) { |
| 38 | ; CHECK-LABEL: select_i64 |
| 39 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 40 | ; CHECK-NEXT: csel {{x[0-9]+}}, x1, x2, ne |
| 41 | %1 = select i1 %c, i64 %a, i64 %b |
| 42 | ret i64 %1 |
| 43 | } |
| 44 | |
| 45 | define float @select_f32(i1 zeroext %c, float %a, float %b) { |
| 46 | ; CHECK-LABEL: select_f32 |
| 47 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 48 | ; CHECK-NEXT: fcsel {{s[0-9]+}}, s0, s1, ne |
| 49 | %1 = select i1 %c, float %a, float %b |
| 50 | ret float %1 |
| 51 | } |
| 52 | |
| 53 | define double @select_f64(i1 zeroext %c, double %a, double %b) { |
| 54 | ; CHECK-LABEL: select_f64 |
| 55 | ; CHECK: {{cmp w0, #0|tst w0, #0x1}} |
| 56 | ; CHECK-NEXT: fcsel {{d[0-9]+}}, d0, d1, ne |
| 57 | %1 = select i1 %c, double %a, double %b |
| 58 | ret double %1 |
| 59 | } |