1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s 2 3 ; CHECK: vunpckhps 4 define <8 x float> @unpackhips(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 5 entry: 6 %shuffle.i = shufflevector <8 x float> %src1, <8 x float> %src2, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15> 7 ret <8 x float> %shuffle.i 8 } 9 10 ; CHECK: vunpckhpd 11 define <4 x double> @unpackhipd(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 12 entry: 13 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 14 ret <4 x double> %shuffle.i 15 } 16 17 ; CHECK: vunpcklps 18 define <8 x float> @unpacklops(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 19 entry: 20 %shuffle.i = shufflevector <8 x float> %src1, <8 x float> %src2, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13> 21 ret <8 x float> %shuffle.i 22 } 23 24 ; CHECK: vunpcklpd 25 define <4 x double> @unpacklopd(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 26 entry: 27 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 28 ret <4 x double> %shuffle.i 29 } 30 31 ; CHECK-NOT: vunpcklps %ymm 32 define <8 x float> @unpacklops-not(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 33 entry: 34 %shuffle.i = shufflevector <8 x float> %src1, <8 x float> %src2, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11> 35 ret <8 x float> %shuffle.i 36 } 37 38 ; CHECK-NOT: vunpcklpd %ymm 39 define <4 x double> @unpacklopd-not(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 40 entry: 41 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 0, i32 4, i32 1, i32 5> 42 ret <4 x double> %shuffle.i 43 } 44 45 ; CHECK-NOT: vunpckhps %ymm 46 define <8 x float> @unpackhips-not(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 47 entry: 48 %shuffle.i = shufflevector <8 x float> %src1, <8 x float> %src2, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13> 49 ret <8 x float> %shuffle.i 50 } 51 52 ; CHECK-NOT: vunpckhpd %ymm 53 define <4 x double> @unpackhipd-not(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 54 entry: 55 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 2, i32 6, i32 3, i32 7> 56 ret <4 x double> %shuffle.i 57 } 58 59 ;;;; 60 ;;;; Unpack versions using the fp unit for int unpacking 61 ;;;; 62 63 ; CHECK: vunpckhps 64 define <8 x i32> @unpackhips1(<8 x i32> %src1, <8 x i32> %src2) nounwind uwtable readnone ssp { 65 entry: 66 %shuffle.i = shufflevector <8 x i32> %src1, <8 x i32> %src2, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15> 67 ret <8 x i32> %shuffle.i 68 } 69 70 ; CHECK: vunpckhps (% 71 define <8 x i32> @unpackhips2(<8 x i32>* %src1, <8 x i32>* %src2) nounwind uwtable readnone ssp { 72 entry: 73 %a = load <8 x i32>, <8 x i32>* %src1 74 %b = load <8 x i32>, <8 x i32>* %src2 75 %shuffle.i = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15> 76 ret <8 x i32> %shuffle.i 77 } 78 79 ; CHECK: vunpckhpd 80 define <4 x i64> @unpackhipd1(<4 x i64> %src1, <4 x i64> %src2) nounwind uwtable readnone ssp { 81 entry: 82 %shuffle.i = shufflevector <4 x i64> %src1, <4 x i64> %src2, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 83 ret <4 x i64> %shuffle.i 84 } 85 86 ; CHECK: vunpckhpd (% 87 define <4 x i64> @unpackhipd2(<4 x i64>* %src1, <4 x i64>* %src2) nounwind uwtable readnone ssp { 88 entry: 89 %a = load <4 x i64>, <4 x i64>* %src1 90 %b = load <4 x i64>, <4 x i64>* %src2 91 %shuffle.i = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 92 ret <4 x i64> %shuffle.i 93 } 94 95 ; CHECK: vunpcklps 96 define <8 x i32> @unpacklops1(<8 x i32> %src1, <8 x i32> %src2) nounwind uwtable readnone ssp { 97 entry: 98 %shuffle.i = shufflevector <8 x i32> %src1, <8 x i32> %src2, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13> 99 ret <8 x i32> %shuffle.i 100 } 101 102 ; CHECK: vunpcklps (% 103 define <8 x i32> @unpacklops2(<8 x i32>* %src1, <8 x i32>* %src2) nounwind uwtable readnone ssp { 104 entry: 105 %a = load <8 x i32>, <8 x i32>* %src1 106 %b = load <8 x i32>, <8 x i32>* %src2 107 %shuffle.i = shufflevector <8 x i32> %a, <8 x i32> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13> 108 ret <8 x i32> %shuffle.i 109 } 110 111 ; CHECK: vunpcklpd 112 define <4 x i64> @unpacklopd1(<4 x i64> %src1, <4 x i64> %src2) nounwind uwtable readnone ssp { 113 entry: 114 %shuffle.i = shufflevector <4 x i64> %src1, <4 x i64> %src2, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 115 ret <4 x i64> %shuffle.i 116 } 117 118 ; CHECK: vunpcklpd (% 119 define <4 x i64> @unpacklopd2(<4 x i64>* %src1, <4 x i64>* %src2) nounwind uwtable readnone ssp { 120 entry: 121 %a = load <4 x i64>, <4 x i64>* %src1 122 %b = load <4 x i64>, <4 x i64>* %src2 123 %shuffle.i = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 124 ret <4 x i64> %shuffle.i 125 } 126 127 ; CHECK: vpunpckhwd 128 ; CHECK: vpunpckhwd 129 ; CHECK: vinsertf128 130 define <16 x i16> @unpackhwd_undef(<16 x i16> %src1) nounwind uwtable readnone ssp { 131 entry: 132 %shuffle.i = shufflevector <16 x i16> %src1, <16 x i16> %src1, <16 x i32> <i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31> 133 ret <16 x i16> %shuffle.i 134 } 135 136 ; CHECK: vpunpcklwd 137 ; CHECK: vpunpcklwd 138 ; CHECK: vinsertf128 139 define <16 x i16> @unpacklwd_undef(<16 x i16> %src1) nounwind uwtable readnone ssp { 140 entry: 141 %shuffle.i = shufflevector <16 x i16> %src1, <16 x i16> %src1, <16 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27> 142 ret <16 x i16> %shuffle.i 143 } 144 145 ; CHECK: vpunpckhbw 146 ; CHECK: vpunpckhbw 147 ; CHECK: vinsertf128 148 define <32 x i8> @unpackhbw_undef(<32 x i8> %src1, <32 x i8> %src2) nounwind uwtable readnone ssp { 149 entry: 150 %shuffle.i = shufflevector <32 x i8> %src1, <32 x i8> %src1, <32 x i32> <i32 8, i32 40, i32 9, i32 41, i32 10, i32 42, i32 11, i32 43, i32 12, i32 44, i32 13, i32 45, i32 14, i32 46, i32 15, i32 47, i32 24, i32 56, i32 25, i32 57, i32 26, i32 58, i32 27, i32 59, i32 28, i32 60, i32 29, i32 61, i32 30, i32 62, i32 31, i32 63> 151 ret <32 x i8> %shuffle.i 152 } 153 154 ; CHECK: vpunpcklbw 155 ; CHECK: vpunpcklbw 156 ; CHECK: vinsertf128 157 define <32 x i8> @unpacklbw_undef(<32 x i8> %src1) nounwind uwtable readnone ssp { 158 entry: 159 %shuffle.i = shufflevector <32 x i8> %src1, <32 x i8> %src1, <32 x i32> <i32 0, i32 32, i32 1, i32 33, i32 2, i32 34, i32 3, i32 35, i32 4, i32 36, i32 5, i32 37, i32 6, i32 38, i32 7, i32 39, i32 16, i32 48, i32 17, i32 49, i32 18, i32 50, i32 19, i32 51, i32 20, i32 52, i32 21, i32 53, i32 22, i32 54, i32 23, i32 55> 160 ret <32 x i8> %shuffle.i 161 } 162