Bruno Cardoso Lopes | b878caa | 2011-07-21 01:55:47 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s |
| 2 | |
Bruno Cardoso Lopes | b878caa | 2011-07-21 01:55:47 +0000 | [diff] [blame] | 3 | |
Chandler Carruth | 34f9a98 | 2014-08-02 10:27:38 +0000 | [diff] [blame] | 4 | ; CHECK: vpshufb {{.*}} ## xmm0 = xmm0[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5] |
Bruno Cardoso Lopes | b878caa | 2011-07-21 01:55:47 +0000 | [diff] [blame] | 5 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | b878caa | 2011-07-21 01:55:47 +0000 | [diff] [blame] | 6 | define <32 x i8> @funcA(<32 x i8> %a) nounwind uwtable readnone ssp { |
| 7 | entry: |
| 8 | %shuffle = shufflevector <32 x i8> %a, <32 x i8> undef, <32 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5> |
| 9 | ret <32 x i8> %shuffle |
| 10 | } |
| 11 | |
Chandler Carruth | 99627bf | 2014-10-04 03:52:55 +0000 | [diff] [blame] | 12 | ; CHECK: vpshufb {{.*}} ## xmm0 = xmm0[10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11] |
Bruno Cardoso Lopes | 178fb40 | 2011-07-21 02:24:08 +0000 | [diff] [blame] | 13 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | 178fb40 | 2011-07-21 02:24:08 +0000 | [diff] [blame] | 14 | define <16 x i16> @funcB(<16 x i16> %a) nounwind uwtable readnone ssp { |
| 15 | entry: |
| 16 | %shuffle = shufflevector <16 x i16> %a, <16 x i16> undef, <16 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5> |
| 17 | ret <16 x i16> %shuffle |
| 18 | } |
| 19 | |
Craig Topper | 72c8cd7 | 2013-10-08 05:53:50 +0000 | [diff] [blame] | 20 | ; CHECK: vmovq |
Chandler Carruth | 99627bf | 2014-10-04 03:52:55 +0000 | [diff] [blame] | 21 | ; CHECK-NEXT: vunpcklpd %xmm |
Bruno Cardoso Lopes | 123dff0 | 2011-07-25 23:05:25 +0000 | [diff] [blame] | 22 | ; CHECK-NEXT: vinsertf128 $1 |
| 23 | define <4 x i64> @funcC(i64 %q) nounwind uwtable readnone ssp { |
| 24 | entry: |
| 25 | %vecinit.i = insertelement <4 x i64> undef, i64 %q, i32 0 |
| 26 | %vecinit2.i = insertelement <4 x i64> %vecinit.i, i64 %q, i32 1 |
| 27 | %vecinit4.i = insertelement <4 x i64> %vecinit2.i, i64 %q, i32 2 |
| 28 | %vecinit6.i = insertelement <4 x i64> %vecinit4.i, i64 %q, i32 3 |
| 29 | ret <4 x i64> %vecinit6.i |
| 30 | } |
| 31 | |
Chandler Carruth | 47ebd24e | 2014-09-14 22:41:37 +0000 | [diff] [blame] | 32 | ; CHECK: vunpcklpd %xmm |
Bruno Cardoso Lopes | 9e9f2ce | 2011-08-23 22:06:37 +0000 | [diff] [blame] | 33 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | 123dff0 | 2011-07-25 23:05:25 +0000 | [diff] [blame] | 34 | define <4 x double> @funcD(double %q) nounwind uwtable readnone ssp { |
| 35 | entry: |
| 36 | %vecinit.i = insertelement <4 x double> undef, double %q, i32 0 |
| 37 | %vecinit2.i = insertelement <4 x double> %vecinit.i, double %q, i32 1 |
| 38 | %vecinit4.i = insertelement <4 x double> %vecinit2.i, double %q, i32 2 |
| 39 | %vecinit6.i = insertelement <4 x double> %vecinit4.i, double %q, i32 3 |
| 40 | ret <4 x double> %vecinit6.i |
| 41 | } |
Bruno Cardoso Lopes | 5ada908 | 2011-08-02 16:06:18 +0000 | [diff] [blame] | 42 | |
Chandler Carruth | 2ebc942 | 2014-07-09 10:06:58 +0000 | [diff] [blame] | 43 | ; Test this turns into a broadcast: |
Bruno Cardoso Lopes | 5ada908 | 2011-08-02 16:06:18 +0000 | [diff] [blame] | 44 | ; shuffle (scalar_to_vector (load (ptr + 4))), undef, <0, 0, 0, 0> |
Chandler Carruth | 2ebc942 | 2014-07-09 10:06:58 +0000 | [diff] [blame] | 45 | ; |
| 46 | ; CHECK: vbroadcastss |
Bruno Cardoso Lopes | a2d8bb9 | 2011-08-11 02:49:44 +0000 | [diff] [blame] | 47 | define <8 x float> @funcE() nounwind { |
Bruno Cardoso Lopes | 5ada908 | 2011-08-02 16:06:18 +0000 | [diff] [blame] | 48 | allocas: |
| 49 | %udx495 = alloca [18 x [18 x float]], align 32 |
| 50 | br label %for_test505.preheader |
| 51 | |
| 52 | for_test505.preheader: ; preds = %for_test505.preheader, %allocas |
| 53 | br i1 undef, label %for_exit499, label %for_test505.preheader |
| 54 | |
| 55 | for_exit499: ; preds = %for_test505.preheader |
| 56 | br i1 undef, label %__load_and_broadcast_32.exit1249, label %load.i1247 |
| 57 | |
| 58 | load.i1247: ; preds = %for_exit499 |
| 59 | %ptr1227 = getelementptr [18 x [18 x float]]* %udx495, i64 0, i64 1, i64 1 |
| 60 | %ptr.i1237 = bitcast float* %ptr1227 to i32* |
| 61 | %val.i1238 = load i32* %ptr.i1237, align 4 |
| 62 | %ret6.i1245 = insertelement <8 x i32> undef, i32 %val.i1238, i32 6 |
| 63 | %ret7.i1246 = insertelement <8 x i32> %ret6.i1245, i32 %val.i1238, i32 7 |
| 64 | %phitmp = bitcast <8 x i32> %ret7.i1246 to <8 x float> |
| 65 | br label %__load_and_broadcast_32.exit1249 |
| 66 | |
| 67 | __load_and_broadcast_32.exit1249: ; preds = %load.i1247, %for_exit499 |
| 68 | %load_broadcast12281250 = phi <8 x float> [ %phitmp, %load.i1247 ], [ undef, %for_exit499 ] |
Bruno Cardoso Lopes | a2d8bb9 | 2011-08-11 02:49:44 +0000 | [diff] [blame] | 69 | ret <8 x float> %load_broadcast12281250 |
Bruno Cardoso Lopes | 5ada908 | 2011-08-02 16:06:18 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Chandler Carruth | 99627bf | 2014-10-04 03:52:55 +0000 | [diff] [blame] | 72 | ; CHECK: vpermilps $4 |
Jakub Staszak | a17f3f8c | 2012-11-26 19:24:31 +0000 | [diff] [blame] | 73 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | 3400825 | 2011-08-17 02:29:15 +0000 | [diff] [blame] | 74 | define <8 x float> @funcF(i32 %val) nounwind { |
Bruno Cardoso Lopes | 572c9aa | 2011-08-11 02:49:41 +0000 | [diff] [blame] | 75 | %ret6 = insertelement <8 x i32> undef, i32 %val, i32 6 |
| 76 | %ret7 = insertelement <8 x i32> %ret6, i32 %val, i32 7 |
| 77 | %tmp = bitcast <8 x i32> %ret7 to <8 x float> |
| 78 | ret <8 x float> %tmp |
| 79 | } |
| 80 | |
Chandler Carruth | 99627bf | 2014-10-04 03:52:55 +0000 | [diff] [blame] | 81 | ; CHECK: vpermilps $0 |
Jakub Staszak | a17f3f8c | 2012-11-26 19:24:31 +0000 | [diff] [blame] | 82 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | a2d8bb9 | 2011-08-11 02:49:44 +0000 | [diff] [blame] | 83 | define <8 x float> @funcG(<8 x float> %a) nounwind uwtable readnone ssp { |
| 84 | entry: |
| 85 | %shuffle = shufflevector <8 x float> %a, <8 x float> undef, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0> |
| 86 | ret <8 x float> %shuffle |
| 87 | } |
| 88 | |
| 89 | ; CHECK: vextractf128 $1 |
Chandler Carruth | 99627bf | 2014-10-04 03:52:55 +0000 | [diff] [blame] | 90 | ; CHECK-NEXT: vpermilps $85 |
Jakub Staszak | a17f3f8c | 2012-11-26 19:24:31 +0000 | [diff] [blame] | 91 | ; CHECK-NEXT: vinsertf128 $1 |
Bruno Cardoso Lopes | a2d8bb9 | 2011-08-11 02:49:44 +0000 | [diff] [blame] | 92 | define <8 x float> @funcH(<8 x float> %a) nounwind uwtable readnone ssp { |
| 93 | entry: |
| 94 | %shuffle = shufflevector <8 x float> %a, <8 x float> undef, <8 x i32> <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5> |
| 95 | ret <8 x float> %shuffle |
| 96 | } |
| 97 | |