Bruno Cardoso Lopes | 8970060 | 2011-09-12 22:59:26 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -promote-elements -mattr=+sse41 | FileCheck %s |
Nadav Rotem | cbdd2d1 | 2011-09-08 08:31:31 +0000 | [diff] [blame] | 2 | |
| 3 | ;CHECK: vsel_float |
| 4 | ;CHECK: blendvps |
| 5 | ;CHECK: ret |
| 6 | define <4 x float> @vsel_float(<4 x float> %v1, <4 x float> %v2) { |
| 7 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x float> %v1, <4 x float> %v2 |
| 8 | ret <4 x float> %vsel |
| 9 | } |
| 10 | |
| 11 | |
Nadav Rotem | 436fe84 | 2011-09-14 14:42:15 +0000 | [diff] [blame] | 12 | ;CHECK: vsel_4xi8 |
| 13 | ;CHECK: blendvps |
| 14 | ;CHECK: ret |
| 15 | define <4 x i8> @vsel_4xi8(<4 x i8> %v1, <4 x i8> %v2) { |
| 16 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x i8> %v1, <4 x i8> %v2 |
| 17 | ret <4 x i8> %vsel |
| 18 | } |
| 19 | |
| 20 | ;CHECK: vsel_4xi16 |
| 21 | ;CHECK: blendvps |
| 22 | ;CHECK: ret |
| 23 | define <4 x i16> @vsel_4xi16(<4 x i16> %v1, <4 x i16> %v2) { |
| 24 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x i16> %v1, <4 x i16> %v2 |
| 25 | ret <4 x i16> %vsel |
| 26 | } |
| 27 | |
| 28 | |
Nadav Rotem | cbdd2d1 | 2011-09-08 08:31:31 +0000 | [diff] [blame] | 29 | ;CHECK: vsel_i32 |
| 30 | ;CHECK: blendvps |
| 31 | ;CHECK: ret |
| 32 | define <4 x i32> @vsel_i32(<4 x i32> %v1, <4 x i32> %v2) { |
| 33 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x i32> %v1, <4 x i32> %v2 |
| 34 | ret <4 x i32> %vsel |
| 35 | } |
| 36 | |
| 37 | |
| 38 | ;CHECK: vsel_double |
Nadav Rotem | a46f35d | 2012-01-02 08:05:46 +0000 | [diff] [blame^] | 39 | ;CHECK-NOT: sra |
Nadav Rotem | cbdd2d1 | 2011-09-08 08:31:31 +0000 | [diff] [blame] | 40 | ;CHECK: blendvpd |
| 41 | ;CHECK: ret |
| 42 | define <4 x double> @vsel_double(<4 x double> %v1, <4 x double> %v2) { |
| 43 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x double> %v1, <4 x double> %v2 |
| 44 | ret <4 x double> %vsel |
| 45 | } |
| 46 | |
| 47 | |
| 48 | ;CHECK: vsel_i64 |
| 49 | ;CHECK: blendvpd |
| 50 | ;CHECK: ret |
| 51 | define <4 x i64> @vsel_i64(<4 x i64> %v1, <4 x i64> %v2) { |
| 52 | %vsel = select <4 x i1> <i1 true, i1 false, i1 false, i1 false>, <4 x i64> %v1, <4 x i64> %v2 |
| 53 | ret <4 x i64> %vsel |
| 54 | } |
| 55 | |
| 56 | |
| 57 | ;CHECK: vsel_i8 |
Nadav Rotem | a46f35d | 2012-01-02 08:05:46 +0000 | [diff] [blame^] | 58 | ;CHECK-NOT: sra |
Nadav Rotem | cbdd2d1 | 2011-09-08 08:31:31 +0000 | [diff] [blame] | 59 | ;CHECK: pblendvb |
| 60 | ;CHECK: ret |
| 61 | define <16 x i8> @vsel_i8(<16 x i8> %v1, <16 x i8> %v2) { |
| 62 | %vsel = select <16 x i1> <i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false, i1 true, i1 false, i1 false, i1 false>, <16 x i8> %v1, <16 x i8> %v2 |
| 63 | ret <16 x i8> %vsel |
| 64 | } |
| 65 | |
Bruno Cardoso Lopes | 8e03a82 | 2011-09-12 19:30:40 +0000 | [diff] [blame] | 66 | ;; TEST blend + compares |
| 67 | ; CHECK: A |
| 68 | define <2 x double> @A(<2 x double> %x, <2 x double> %y) { |
Bruno Cardoso Lopes | 457d53d | 2011-09-12 21:24:07 +0000 | [diff] [blame] | 69 | ; CHECK: cmplepd |
Nadav Rotem | a46f35d | 2012-01-02 08:05:46 +0000 | [diff] [blame^] | 70 | ; CHECK-NOT: sra |
Bruno Cardoso Lopes | 8e03a82 | 2011-09-12 19:30:40 +0000 | [diff] [blame] | 71 | ; CHECK: blendvpd |
| 72 | %max_is_x = fcmp oge <2 x double> %x, %y |
| 73 | %max = select <2 x i1> %max_is_x, <2 x double> %x, <2 x double> %y |
| 74 | ret <2 x double> %max |
| 75 | } |
| 76 | |
| 77 | ; CHECK: B |
| 78 | define <2 x double> @B(<2 x double> %x, <2 x double> %y) { |
Duncan Sands | 6bcd219 | 2011-09-17 16:49:39 +0000 | [diff] [blame] | 79 | ; CHECK: cmpnlepd |
Nadav Rotem | a46f35d | 2012-01-02 08:05:46 +0000 | [diff] [blame^] | 80 | ; CHECK-NOT: sra |
Bruno Cardoso Lopes | 8e03a82 | 2011-09-12 19:30:40 +0000 | [diff] [blame] | 81 | ; CHECK: blendvpd |
Duncan Sands | 6bcd219 | 2011-09-17 16:49:39 +0000 | [diff] [blame] | 82 | %min_is_x = fcmp ult <2 x double> %x, %y |
| 83 | %min = select <2 x i1> %min_is_x, <2 x double> %x, <2 x double> %y |
| 84 | ret <2 x double> %min |
Bruno Cardoso Lopes | 8e03a82 | 2011-09-12 19:30:40 +0000 | [diff] [blame] | 85 | } |
Nadav Rotem | cbdd2d1 | 2011-09-08 08:31:31 +0000 | [diff] [blame] | 86 | |