1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s 3 4define <8 x float> @unpackhips(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 5; CHECK-LABEL: unpackhips: 6; CHECK: # %bb.0: 7; CHECK-NEXT: vunpckhps {{.*#+}} ymm0 = ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[6],ymm1[6],ymm0[7],ymm1[7] 8; CHECK-NEXT: retq 9 %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> 10 ret <8 x float> %shuffle.i 11} 12 13define <4 x double> @unpackhipd(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 14; CHECK-LABEL: unpackhipd: 15; CHECK: # %bb.0: 16; CHECK-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3] 17; CHECK-NEXT: retq 18 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 19 ret <4 x double> %shuffle.i 20} 21 22define <8 x float> @unpacklops(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 23; CHECK-LABEL: unpacklops: 24; CHECK: # %bb.0: 25; CHECK-NEXT: vunpcklps {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5] 26; CHECK-NEXT: retq 27 %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> 28 ret <8 x float> %shuffle.i 29} 30 31define <4 x double> @unpacklopd(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 32; CHECK-LABEL: unpacklopd: 33; CHECK: # %bb.0: 34; CHECK-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2] 35; CHECK-NEXT: retq 36 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 37 ret <4 x double> %shuffle.i 38} 39 40define <8 x float> @unpacklops_not(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 41; CHECK-LABEL: unpacklops_not: 42; CHECK: # %bb.0: 43; CHECK-NEXT: vunpckhps {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3] 44; CHECK-NEXT: vunpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] 45; CHECK-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0 46; CHECK-NEXT: retq 47 %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> 48 ret <8 x float> %shuffle.i 49} 50 51define <4 x double> @unpacklopd_not(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 52; CHECK-LABEL: unpacklopd_not: 53; CHECK: # %bb.0: 54; CHECK-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1] 55; CHECK-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0] 56; CHECK-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0 57; CHECK-NEXT: retq 58 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 0, i32 4, i32 1, i32 5> 59 ret <4 x double> %shuffle.i 60} 61 62define <8 x float> @unpackhips_not(<8 x float> %src1, <8 x float> %src2) nounwind uwtable readnone ssp { 63; CHECK-LABEL: unpackhips_not: 64; CHECK: # %bb.0: 65; CHECK-NEXT: vpermilps {{.*#+}} ymm1 = ymm1[u,2,u,3,u,4,u,5] 66; CHECK-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,u,3,u,4,u,5,u] 67; CHECK-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3],ymm0[4],ymm1[5],ymm0[6],ymm1[7] 68; CHECK-NEXT: retq 69 %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> 70 ret <8 x float> %shuffle.i 71} 72 73define <4 x double> @unpackhipd_not(<4 x double> %src1, <4 x double> %src2) nounwind uwtable readnone ssp { 74; CHECK-LABEL: unpackhipd_not: 75; CHECK: # %bb.0: 76; CHECK-NEXT: vextractf128 $1, %ymm1, %xmm1 77; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 78; CHECK-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1] 79; CHECK-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0] 80; CHECK-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0 81; CHECK-NEXT: retq 82 %shuffle.i = shufflevector <4 x double> %src1, <4 x double> %src2, <4 x i32> <i32 2, i32 6, i32 3, i32 7> 83 ret <4 x double> %shuffle.i 84} 85 86;;;; 87;;;; Unpack versions using the fp unit for int unpacking 88;;;; 89 90define <8 x i32> @unpackhips1(<8 x i32> %src1, <8 x i32> %src2) nounwind uwtable readnone ssp { 91; CHECK-LABEL: unpackhips1: 92; CHECK: # %bb.0: 93; CHECK-NEXT: vunpckhps {{.*#+}} ymm0 = ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[6],ymm1[6],ymm0[7],ymm1[7] 94; CHECK-NEXT: retq 95 %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> 96 ret <8 x i32> %shuffle.i 97} 98 99define <8 x i32> @unpackhips2(<8 x i32>* %src1, <8 x i32>* %src2) nounwind uwtable readnone ssp { 100; CHECK-LABEL: unpackhips2: 101; CHECK: # %bb.0: 102; CHECK-NEXT: vmovaps (%rdi), %ymm0 103; CHECK-NEXT: vunpckhps {{.*#+}} ymm0 = ymm0[2],mem[2],ymm0[3],mem[3],ymm0[6],mem[6],ymm0[7],mem[7] 104; CHECK-NEXT: retq 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 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15> 108 ret <8 x i32> %shuffle.i 109} 110 111define <4 x i64> @unpackhipd1(<4 x i64> %src1, <4 x i64> %src2) nounwind uwtable readnone ssp { 112; CHECK-LABEL: unpackhipd1: 113; CHECK: # %bb.0: 114; CHECK-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3] 115; CHECK-NEXT: retq 116 %shuffle.i = shufflevector <4 x i64> %src1, <4 x i64> %src2, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 117 ret <4 x i64> %shuffle.i 118} 119 120define <4 x i64> @unpackhipd2(<4 x i64>* %src1, <4 x i64>* %src2) nounwind uwtable readnone ssp { 121; CHECK-LABEL: unpackhipd2: 122; CHECK: # %bb.0: 123; CHECK-NEXT: vmovaps (%rdi), %ymm0 124; CHECK-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],mem[1],ymm0[3],mem[3] 125; CHECK-NEXT: retq 126 %a = load <4 x i64>, <4 x i64>* %src1 127 %b = load <4 x i64>, <4 x i64>* %src2 128 %shuffle.i = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7> 129 ret <4 x i64> %shuffle.i 130} 131 132define <8 x i32> @unpacklops1(<8 x i32> %src1, <8 x i32> %src2) nounwind uwtable readnone ssp { 133; CHECK-LABEL: unpacklops1: 134; CHECK: # %bb.0: 135; CHECK-NEXT: vunpcklps {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5] 136; CHECK-NEXT: retq 137 %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> 138 ret <8 x i32> %shuffle.i 139} 140 141define <8 x i32> @unpacklops2(<8 x i32>* %src1, <8 x i32>* %src2) nounwind uwtable readnone ssp { 142; CHECK-LABEL: unpacklops2: 143; CHECK: # %bb.0: 144; CHECK-NEXT: vmovaps (%rdi), %ymm0 145; CHECK-NEXT: vunpcklps {{.*#+}} ymm0 = ymm0[0],mem[0],ymm0[1],mem[1],ymm0[4],mem[4],ymm0[5],mem[5] 146; CHECK-NEXT: retq 147 %a = load <8 x i32>, <8 x i32>* %src1 148 %b = load <8 x i32>, <8 x i32>* %src2 149 %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> 150 ret <8 x i32> %shuffle.i 151} 152 153define <4 x i64> @unpacklopd1(<4 x i64> %src1, <4 x i64> %src2) nounwind uwtable readnone ssp { 154; CHECK-LABEL: unpacklopd1: 155; CHECK: # %bb.0: 156; CHECK-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2] 157; CHECK-NEXT: retq 158 %shuffle.i = shufflevector <4 x i64> %src1, <4 x i64> %src2, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 159 ret <4 x i64> %shuffle.i 160} 161 162define <4 x i64> @unpacklopd2(<4 x i64>* %src1, <4 x i64>* %src2) nounwind uwtable readnone ssp { 163; CHECK-LABEL: unpacklopd2: 164; CHECK: # %bb.0: 165; CHECK-NEXT: vmovaps (%rdi), %ymm0 166; CHECK-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],mem[0],ymm0[2],mem[2] 167; CHECK-NEXT: retq 168 %a = load <4 x i64>, <4 x i64>* %src1 169 %b = load <4 x i64>, <4 x i64>* %src2 170 %shuffle.i = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6> 171 ret <4 x i64> %shuffle.i 172} 173 174define <16 x i16> @unpackhwd_undef(<16 x i16> %src1) nounwind uwtable readnone ssp { 175; CHECK-LABEL: unpackhwd_undef: 176; CHECK: # %bb.0: 177; CHECK-NEXT: vpunpckhwd {{.*#+}} xmm1 = xmm0[4,4,5,5,6,6,7,7] 178; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 179; CHECK-NEXT: vpunpckhwd {{.*#+}} xmm0 = xmm0[4,4,5,5,6,6,7,7] 180; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 181; CHECK-NEXT: retq 182 %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> 183 ret <16 x i16> %shuffle.i 184} 185 186define <16 x i16> @unpacklwd_undef(<16 x i16> %src1) nounwind uwtable readnone ssp { 187; CHECK-LABEL: unpacklwd_undef: 188; CHECK: # %bb.0: 189; CHECK-NEXT: vpunpcklwd {{.*#+}} xmm1 = xmm0[0,0,1,1,2,2,3,3] 190; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 191; CHECK-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3] 192; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 193; CHECK-NEXT: retq 194 %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> 195 ret <16 x i16> %shuffle.i 196} 197 198define <32 x i8> @unpackhbw_undef(<32 x i8> %src1, <32 x i8> %src2) nounwind uwtable readnone ssp { 199; CHECK-LABEL: unpackhbw_undef: 200; CHECK: # %bb.0: 201; CHECK-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15] 202; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 203; CHECK-NEXT: vpunpckhbw {{.*#+}} xmm0 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15] 204; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 205; CHECK-NEXT: retq 206 %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> 207 ret <32 x i8> %shuffle.i 208} 209 210define <32 x i8> @unpacklbw_undef(<32 x i8> %src1) nounwind uwtable readnone ssp { 211; CHECK-LABEL: unpacklbw_undef: 212; CHECK: # %bb.0: 213; CHECK-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7] 214; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 215; CHECK-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7] 216; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0 217; CHECK-NEXT: retq 218 %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> 219 ret <32 x i8> %shuffle.i 220} 221 222