1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X32 3; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2,+xop | FileCheck %s --check-prefix=X32 4; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X64 5; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+xop | FileCheck %s --check-prefix=X64 6 7declare <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double>, <2 x double>, <2 x i64>, i8) nounwind readnone 8declare <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double>, <4 x double>, <4 x i64>, i8) nounwind readnone 9 10declare <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float>, <4 x float>, <4 x i32>, i8) nounwind readnone 11declare <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float>, <8 x float>, <8 x i32>, i8) nounwind readnone 12 13declare <16 x i8> @llvm.x86.xop.vpperm(<16 x i8>, <16 x i8>, <16 x i8>) nounwind readnone 14 15define <2 x double> @combine_vpermil2pd_identity(<2 x double> %a0, <2 x double> %a1) { 16; X32-LABEL: combine_vpermil2pd_identity: 17; X32: # BB#0: 18; X32-NEXT: vmovaps %xmm1, %xmm0 19; X32-NEXT: retl 20; 21; X64-LABEL: combine_vpermil2pd_identity: 22; X64: # BB#0: 23; X64-NEXT: vmovaps %xmm1, %xmm0 24; X64-NEXT: retq 25 %res0 = call <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double> %a1, <2 x double> %a0, <2 x i64> <i64 2, i64 0>, i8 0) 26 %res1 = call <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double> %res0, <2 x double> undef, <2 x i64> <i64 2, i64 0>, i8 0) 27 ret <2 x double> %res1 28} 29 30define <4 x double> @combine_vpermil2pd256_identity(<4 x double> %a0, <4 x double> %a1) { 31; X32-LABEL: combine_vpermil2pd256_identity: 32; X32: # BB#0: 33; X32-NEXT: vmovaps %ymm1, %ymm0 34; X32-NEXT: retl 35; 36; X64-LABEL: combine_vpermil2pd256_identity: 37; X64: # BB#0: 38; X64-NEXT: vmovaps %ymm1, %ymm0 39; X64-NEXT: retq 40 %res0 = call <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double> %a1, <4 x double> %a0, <4 x i64> <i64 2, i64 0, i64 2, i64 0>, i8 0) 41 %res1 = call <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double> %res0, <4 x double> undef, <4 x i64> <i64 2, i64 0, i64 2, i64 0>, i8 0) 42 ret <4 x double> %res1 43} 44 45define <4 x double> @combine_vpermil2pd256_0z73(<4 x double> %a0, <4 x double> %a1) { 46; X32-LABEL: combine_vpermil2pd256_0z73: 47; X32: # BB#0: 48; X32-NEXT: vpermil2pd {{.*#+}} ymm0 = ymm0[0],zero,ymm1[3],ymm0[3] 49; X32-NEXT: retl 50; 51; X64-LABEL: combine_vpermil2pd256_0z73: 52; X64: # BB#0: 53; X64-NEXT: vpermil2pd {{.*#+}} ymm0 = ymm0[0],zero,ymm1[3],ymm0[3] 54; X64-NEXT: retq 55 %res0 = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 0, i32 undef, i32 7, i32 3> 56 %res1 = shufflevector <4 x double> %res0, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 7, i32 2, i32 3> 57 ret <4 x double> %res1 58} 59 60define <4 x float> @combine_vpermil2ps_identity(<4 x float> %a0, <4 x float> %a1) { 61; X32-LABEL: combine_vpermil2ps_identity: 62; X32: # BB#0: 63; X32-NEXT: vmovaps %xmm1, %xmm0 64; X32-NEXT: retl 65; 66; X64-LABEL: combine_vpermil2ps_identity: 67; X64: # BB#0: 68; X64-NEXT: vmovaps %xmm1, %xmm0 69; X64-NEXT: retq 70 %res0 = call <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float> %a1, <4 x float> %a0, <4 x i32> <i32 3, i32 2, i32 1, i32 0>, i8 0) 71 %res1 = call <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float> %res0, <4 x float> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>, i8 0) 72 ret <4 x float> %res1 73} 74 75define <4 x float> @combine_vpermil2ps_1z74(<4 x float> %a0, <4 x float> %a1) { 76; X32-LABEL: combine_vpermil2ps_1z74: 77; X32: # BB#0: 78; X32-NEXT: vpermil2ps {{.*#+}} xmm0 = xmm0[1],zero,xmm1[3,0] 79; X32-NEXT: retl 80; 81; X64-LABEL: combine_vpermil2ps_1z74: 82; X64: # BB#0: 83; X64-NEXT: vpermil2ps {{.*#+}} xmm0 = xmm0[1],zero,xmm1[3,0] 84; X64-NEXT: retq 85 %res0 = call <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 1, i32 1, i32 7, i32 4>, i8 0) 86 %res1 = shufflevector <4 x float> %res0, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 7, i32 2, i32 3> 87 ret <4 x float> %res1 88} 89 90define <8 x float> @combine_vpermil2ps256_identity(<8 x float> %a0, <8 x float> %a1) { 91; X32-LABEL: combine_vpermil2ps256_identity: 92; X32: # BB#0: 93; X32-NEXT: vmovaps %ymm1, %ymm0 94; X32-NEXT: retl 95; 96; X64-LABEL: combine_vpermil2ps256_identity: 97; X64: # BB#0: 98; X64-NEXT: vmovaps %ymm1, %ymm0 99; X64-NEXT: retq 100 %res0 = call <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float> %a1, <8 x float> %a0, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 1, i32 0, i32 3, i32 2>, i8 0) 101 %res1 = call <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float> %res0, <8 x float> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 1, i32 0, i32 3, i32 2>, i8 0) 102 ret <8 x float> %res1 103} 104 105define <8 x float> @combine_vpermil2ps256_08z945Az(<8 x float> %a0, <8 x float> %a1) { 106; X32-LABEL: combine_vpermil2ps256_08z945Az: 107; X32: # BB#0: 108; X32-NEXT: vpermil2ps {{.*#+}} ymm0 = ymm0[0],ymm1[0],zero,ymm1[1],ymm0[4,5],ymm1[6],zero 109; X32-NEXT: retl 110; 111; X64-LABEL: combine_vpermil2ps256_08z945Az: 112; X64: # BB#0: 113; X64-NEXT: vpermil2ps {{.*#+}} ymm0 = ymm0[0],ymm1[0],zero,ymm1[1],ymm0[4,5],ymm1[6],zero 114; X64-NEXT: retq 115 %res0 = call <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float> %a0, <8 x float> %a1, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 0, i32 1, i32 6, i32 7>, i8 0) 116 %res1 = shufflevector <8 x float> %res0, <8 x float> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 8, i32 3, i32 4, i32 5, i32 6, i32 8> 117 ret <8 x float> %res1 118} 119 120define <8 x float> @combine_vpermil2ps256_zero(<8 x float> %a0, <8 x float> %a1) { 121; X32-LABEL: combine_vpermil2ps256_zero: 122; X32: # BB#0: 123; X32-NEXT: vxorps %ymm0, %ymm0, %ymm0 124; X32-NEXT: retl 125; 126; X64-LABEL: combine_vpermil2ps256_zero: 127; X64: # BB#0: 128; X64-NEXT: vxorps %ymm0, %ymm0, %ymm0 129; X64-NEXT: retq 130 %res0 = call <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float> %a1, <8 x float> %a0, <8 x i32> <i32 8, i32 9, i32 10, i32 11, i32 8, i32 9, i32 10, i32 11>, i8 2) 131 ret <8 x float> %res0 132} 133 134define <4 x float> @combine_vpermil2ps_blend_with_zero(<4 x float> %a0, <4 x float> %a1) { 135; X32-LABEL: combine_vpermil2ps_blend_with_zero: 136; X32: # BB#0: 137; X32-NEXT: vxorps %xmm1, %xmm1, %xmm1 138; X32-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3] 139; X32-NEXT: retl 140; 141; X64-LABEL: combine_vpermil2ps_blend_with_zero: 142; X64: # BB#0: 143; X64-NEXT: vxorps %xmm1, %xmm1, %xmm1 144; X64-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3] 145; X64-NEXT: retq 146 %res0 = call <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float> %a0, <4 x float> %a1, <4 x i32> <i32 8, i32 1, i32 2, i32 3>, i8 2) 147 ret <4 x float> %res0 148} 149 150define <2 x double> @combine_vpermil2pd_as_shufpd(<2 x double> %a0, <2 x double> %a1) { 151; X32-LABEL: combine_vpermil2pd_as_shufpd: 152; X32: # BB#0: 153; X32-NEXT: vshufpd {{.*#+}} xmm0 = xmm0[1],xmm1[0] 154; X32-NEXT: retl 155; 156; X64-LABEL: combine_vpermil2pd_as_shufpd: 157; X64: # BB#0: 158; X64-NEXT: vshufpd {{.*#+}} xmm0 = xmm0[1],xmm1[0] 159; X64-NEXT: retq 160 %res0 = call <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double> %a0, <2 x double> %a1, <2 x i64> <i64 2, i64 4>, i8 0) 161 ret <2 x double> %res0 162} 163 164define <4 x double> @combine_vpermil2pd256_as_shufpd(<4 x double> %a0, <4 x double> %a1) { 165; X32-LABEL: combine_vpermil2pd256_as_shufpd: 166; X32: # BB#0: 167; X32-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3] 168; X32-NEXT: retl 169; 170; X64-LABEL: combine_vpermil2pd256_as_shufpd: 171; X64: # BB#0: 172; X64-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3] 173; X64-NEXT: retq 174 %res0 = call <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double> %a0, <4 x double> %a1, <4 x i64> <i64 0, i64 4, i64 2, i64 7>, i8 0) 175 ret <4 x double> %res0 176} 177 178define <16 x i8> @combine_vpperm_identity(<16 x i8> %a0, <16 x i8> %a1) { 179; X32-LABEL: combine_vpperm_identity: 180; X32: # BB#0: 181; X32-NEXT: vmovaps %xmm1, %xmm0 182; X32-NEXT: retl 183; 184; X64-LABEL: combine_vpperm_identity: 185; X64: # BB#0: 186; X64-NEXT: vmovaps %xmm1, %xmm0 187; X64-NEXT: retq 188 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> <i8 31, i8 30, i8 29, i8 28, i8 27, i8 26, i8 25, i8 24, i8 23, i8 22, i8 21, i8 20, i8 19, i8 18, i8 17, i8 16>) 189 %res1 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %res0, <16 x i8> undef, <16 x i8> <i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>) 190 ret <16 x i8> %res1 191} 192 193define <16 x i8> @combine_vpperm_zero(<16 x i8> %a0, <16 x i8> %a1) { 194; X32-LABEL: combine_vpperm_zero: 195; X32: # BB#0: 196; X32-NEXT: vxorps %xmm0, %xmm0, %xmm0 197; X32-NEXT: retl 198; 199; X64-LABEL: combine_vpperm_zero: 200; X64: # BB#0: 201; X64-NEXT: vxorps %xmm0, %xmm0, %xmm0 202; X64-NEXT: retq 203 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> <i8 128, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>) 204 %res1 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %res0, <16 x i8> undef, <16 x i8> <i8 0, i8 128, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>) 205 %res2 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %res1, <16 x i8> undef, <16 x i8> <i8 0, i8 1, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>) 206 ret <16 x i8> %res2 207} 208 209define <16 x i8> @combine_vpperm_identity_bitcast(<16 x i8> %a0, <16 x i8> %a1) { 210; X32-LABEL: combine_vpperm_identity_bitcast: 211; X32: # BB#0: 212; X32-NEXT: vpaddq {{\.LCPI.*}}, %xmm0, %xmm0 213; X32-NEXT: retl 214; 215; X64-LABEL: combine_vpperm_identity_bitcast: 216; X64: # BB#0: 217; X64-NEXT: vpaddq {{.*}}(%rip), %xmm0, %xmm0 218; X64-NEXT: retq 219 %mask = bitcast <2 x i64> <i64 1084818905618843912, i64 506097522914230528> to <16 x i8> 220 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> %mask) 221 %res1 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %res0, <16 x i8> undef, <16 x i8> %mask) 222 %res2 = bitcast <16 x i8> %res1 to <2 x i64> 223 %res3 = add <2 x i64> %res2, <i64 1084818905618843912, i64 506097522914230528> 224 %res4 = bitcast <2 x i64> %res3 to <16 x i8> 225 ret <16 x i8> %res4 226} 227 228define <16 x i8> @combine_vpperm_as_blend_with_zero(<16 x i8> %a0, <16 x i8> %a1) { 229; X32-LABEL: combine_vpperm_as_blend_with_zero: 230; X32: # BB#0: 231; X32-NEXT: vpxor %xmm1, %xmm1, %xmm1 232; X32-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3],xmm1[4,5,6,7] 233; X32-NEXT: retl 234; 235; X64-LABEL: combine_vpperm_as_blend_with_zero: 236; X64: # BB#0: 237; X64-NEXT: vpxor %xmm1, %xmm1, %xmm1 238; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3],xmm1[4,5,6,7] 239; X64-NEXT: retq 240 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> <i8 0, i8 1, i8 128, i8 129, i8 4, i8 5, i8 6, i8 7, i8 130, i8 131, i8 132, i8 133, i8 134, i8 135, i8 136, i8 137>) 241 ret <16 x i8> %res0 242} 243 244define <16 x i8> @combine_vpperm_as_unary_unpckhbw(<16 x i8> %a0, <16 x i8> %a1) { 245; X32-LABEL: combine_vpperm_as_unary_unpckhbw: 246; X32: # BB#0: 247; X32-NEXT: vpunpckhbw {{.*#+}} xmm0 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15] 248; X32-NEXT: retl 249; 250; X64-LABEL: combine_vpperm_as_unary_unpckhbw: 251; X64: # BB#0: 252; X64-NEXT: vpunpckhbw {{.*#+}} xmm0 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15] 253; X64-NEXT: retq 254 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a0, <16 x i8> <i8 8, i8 undef, i8 9, i8 25, i8 10, i8 26, i8 11, i8 27, i8 12, i8 28, i8 13, i8 29, i8 14, i8 30, i8 15, i8 31>) 255 ret <16 x i8> %res0 256} 257 258define <16 x i8> @combine_vpperm_as_unpckhbw(<16 x i8> %a0, <16 x i8> %a1) { 259; X32-LABEL: combine_vpperm_as_unpckhbw: 260; X32: # BB#0: 261; X32-NEXT: vpunpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15] 262; X32-NEXT: retl 263; 264; X64-LABEL: combine_vpperm_as_unpckhbw: 265; X64: # BB#0: 266; X64-NEXT: vpunpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15] 267; X64-NEXT: retq 268 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> <i8 8, i8 24, i8 9, i8 25, i8 10, i8 26, i8 11, i8 27, i8 12, i8 28, i8 13, i8 29, i8 14, i8 30, i8 15, i8 31>) 269 ret <16 x i8> %res0 270} 271 272define <16 x i8> @combine_vpperm_as_unpcklbw(<16 x i8> %a0, <16 x i8> %a1) { 273; X32-LABEL: combine_vpperm_as_unpcklbw: 274; X32: # BB#0: 275; X32-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] 276; X32-NEXT: retl 277; 278; X64-LABEL: combine_vpperm_as_unpcklbw: 279; X64: # BB#0: 280; X64-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7] 281; X64-NEXT: retq 282 %res0 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> <i8 16, i8 0, i8 17, i8 1, i8 18, i8 2, i8 19, i8 3, i8 20, i8 4, i8 21, i8 5, i8 22, i8 6, i8 23, i8 7>) 283 ret <16 x i8> %res0 284} 285 286define <4 x i32> @combine_vpperm_10zz32BA(<4 x i32> %a0, <4 x i32> %a1) { 287; X32-LABEL: combine_vpperm_10zz32BA: 288; X32: # BB#0: 289; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm0[2,3,0,1],zero,zero,zero,zero,xmm0[6,7,4,5],xmm1[6,7,4,5] 290; X32-NEXT: retl 291; 292; X64-LABEL: combine_vpperm_10zz32BA: 293; X64: # BB#0: 294; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm0[2,3,0,1],zero,zero,zero,zero,xmm0[6,7,4,5],xmm1[6,7,4,5] 295; X64-NEXT: retq 296 %res0 = shufflevector <4 x i32> %a0, <4 x i32> %a1, <4 x i32> <i32 0, i32 4, i32 1, i32 5> 297 %res1 = bitcast <4 x i32> %res0 to <16 x i8> 298 %res2 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %res1, <16 x i8> undef, <16 x i8> <i8 2, i8 3, i8 0, i8 1, i8 128, i8 128, i8 128, i8 128, i8 10, i8 11, i8 8, i8 9, i8 14, i8 15, i8 12, i8 13>) 299 %res3 = bitcast <16 x i8> %res2 to <4 x i32> 300 ret <4 x i32> %res3 301} 302 303define void @buildvector_v4f23_0404(float %a, float %b, <4 x float>* %ptr) { 304; X32-LABEL: buildvector_v4f23_0404: 305; X32: # BB#0: 306; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 307; X32-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero 308; X32-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1],mem[0],xmm0[3] 309; X32-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1,2],mem[0] 310; X32-NEXT: vmovaps %xmm0, (%eax) 311; X32-NEXT: retl 312; 313; X64-LABEL: buildvector_v4f23_0404: 314; X64: # BB#0: 315; X64-NEXT: vpermil2ps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[0],xmm1[0] 316; X64-NEXT: vmovaps %xmm0, (%rdi) 317; X64-NEXT: retq 318 %v0 = insertelement <4 x float> undef, float %a, i32 0 319 %v1 = insertelement <4 x float> %v0, float %b, i32 1 320 %v2 = insertelement <4 x float> %v1, float %a, i32 2 321 %v3 = insertelement <4 x float> %v2, float %b, i32 3 322 store <4 x float> %v3, <4 x float>* %ptr 323 ret void 324} 325 326define <2 x double> @constant_fold_vpermil2pd() { 327; X32-LABEL: constant_fold_vpermil2pd: 328; X32: # BB#0: 329; X32-NEXT: vmovaps {{.*#+}} xmm0 = [-2.000000e+00,2.000000e+00] 330; X32-NEXT: retl 331; 332; X64-LABEL: constant_fold_vpermil2pd: 333; X64: # BB#0: 334; X64-NEXT: vmovaps {{.*#+}} xmm0 = [-2.000000e+00,2.000000e+00] 335; X64-NEXT: retq 336 %1 = call <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double> <double 1.0, double 2.0>, <2 x double> <double -2.0, double -1.0>, <2 x i64> <i64 4, i64 2>, i8 2) 337 ret <2 x double> %1 338} 339 340define <4 x double> @constant_fold_vpermil2pd_256() { 341; X32-LABEL: constant_fold_vpermil2pd_256: 342; X32: # BB#0: 343; X32-NEXT: vmovaps {{.*#+}} ymm0 = [-4.000000e+00,0.000000e+00,4.000000e+00,3.000000e+00] 344; X32-NEXT: retl 345; 346; X64-LABEL: constant_fold_vpermil2pd_256: 347; X64: # BB#0: 348; X64-NEXT: vmovaps {{.*#+}} ymm0 = [-4.000000e+00,0.000000e+00,4.000000e+00,3.000000e+00] 349; X64-NEXT: retq 350 %1 = call <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double> <double 1.0, double 2.0, double 3.0, double 4.0>, <4 x double> <double -4.0, double -3.0, double -2.0, double -1.0>, <4 x i64> <i64 4, i64 8, i64 2, i64 0>, i8 2) 351 ret <4 x double> %1 352} 353 354define <4 x float> @constant_fold_vpermil2ps() { 355; X32-LABEL: constant_fold_vpermil2ps: 356; X32: # BB#0: 357; X32-NEXT: vmovaps {{.*#+}} xmm0 = [-4.000000e+00,1.000000e+00,3.000000e+00,0.000000e+00] 358; X32-NEXT: retl 359; 360; X64-LABEL: constant_fold_vpermil2ps: 361; X64: # BB#0: 362; X64-NEXT: vmovaps {{.*#+}} xmm0 = [-4.000000e+00,1.000000e+00,3.000000e+00,0.000000e+00] 363; X64-NEXT: retq 364 %1 = call <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float> <float 1.0, float 2.0, float 3.0, float 4.0>, <4 x float> <float -4.0, float -3.0, float -2.0, float -1.0>, <4 x i32> <i32 4, i32 0, i32 2, i32 8>, i8 2) 365 ret <4 x float> %1 366} 367 368define <8 x float> @constant_fold_vpermil2ps_256() { 369; X32-LABEL: constant_fold_vpermil2ps_256: 370; X32: # BB#0: 371; X32-NEXT: vmovaps {{.*#+}} ymm0 = [-8.000000e+00,1.000000e+00,3.000000e+00,0.000000e+00,5.000000e+00,0.000000e+00,5.000000e+00,7.000000e+00] 372; X32-NEXT: retl 373; 374; X64-LABEL: constant_fold_vpermil2ps_256: 375; X64: # BB#0: 376; X64-NEXT: vmovaps {{.*#+}} ymm0 = [-8.000000e+00,1.000000e+00,3.000000e+00,0.000000e+00,5.000000e+00,0.000000e+00,5.000000e+00,7.000000e+00] 377; X64-NEXT: retq 378 %1 = call <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float> <float 1.0, float 2.0, float 3.0, float 4.0, float 5.0, float 6.0, float 7.0, float 8.0>, <8 x float> <float -8.0, float -7.0, float -6.0, float -5.0, float -4.0, float -3.0, float -2.0, float -1.0>, <8 x i32> <i32 4, i32 0, i32 2, i32 8, i32 0, i32 8, i32 0, i32 2>, i8 2) 379 ret <8 x float> %1 380} 381 382define <16 x i8> @constant_fold_vpperm() { 383; X32-LABEL: constant_fold_vpperm: 384; X32: # BB#0: 385; X32-NEXT: vmovaps {{.*#+}} xmm0 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] 386; X32-NEXT: retl 387; 388; X64-LABEL: constant_fold_vpperm: 389; X64: # BB#0: 390; X64-NEXT: vmovaps {{.*#+}} xmm0 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] 391; X64-NEXT: retq 392 %1 = call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> <i8 0, i8 -1, i8 -2, i8 -3, i8 -4, i8 -5, i8 -6, i8 -7, i8 -8, i8 -9, i8 -10, i8 -11, i8 -12, i8 -13, i8 -14, i8 -15>, <16 x i8> <i8 15, i8 14, i8 13, i8 12, i8 11, i8 10, i8 9, i8 8, i8 7, i8 6, i8 5, i8 4, i8 3, i8 2, i8 1, i8 0>, <16 x i8> <i8 31, i8 30, i8 29, i8 28, i8 27, i8 26, i8 25, i8 24, i8 23, i8 22, i8 21, i8 20, i8 19, i8 18, i8 17, i8 16>) 393 ret <16 x i8> %1 394} 395 396define <4 x float> @PR31296(i8* %in) { 397; X32-LABEL: PR31296: 398; X32: # BB#0: # %entry 399; X32-NEXT: movl {{[0-9]+}}(%esp), %eax 400; X32-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero 401; X32-NEXT: vmovaps {{.*#+}} xmm1 = <0,1,u,u> 402; X32-NEXT: vpermil2ps {{.*#+}} xmm0 = xmm0[0],xmm1[0,0,1] 403; X32-NEXT: retl 404; 405; X64-LABEL: PR31296: 406; X64: # BB#0: # %entry 407; X64-NEXT: movl (%rdi), %eax 408; X64-NEXT: vmovq %rax, %xmm0 409; X64-NEXT: vmovaps {{.*#+}} xmm1 = <0,1,u,u> 410; X64-NEXT: vpermil2ps {{.*#+}} xmm0 = xmm0[0],xmm1[0,0,1] 411; X64-NEXT: retq 412entry: 413 %0 = getelementptr i8, i8* %in, i32 0 414 %1 = bitcast i8* %0 to i32* 415 %2 = load i32, i32* %1 416 %3 = zext i32 %2 to i128 417 %4 = bitcast i128 %3 to <4 x float> 418 %5 = shufflevector <4 x float> %4, <4 x float> <float 0.000000e+00, float 1.000000e+00, float undef, float undef>, <4 x i32> <i32 0, i32 4, i32 4, i32 5> 419 ret <4 x float> %5 420} 421