diff --git a/llvm/test/CodeGen/X86/xop-mask-comments.ll b/llvm/test/CodeGen/X86/xop-mask-comments.ll new file mode 100644 index 000000000000..363aa9e65529 --- /dev/null +++ b/llvm/test/CodeGen/X86/xop-mask-comments.ll @@ -0,0 +1,104 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X32 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+xop | FileCheck %s --check-prefix=X64 + +; +; VPPERM +; + +define <16 x i8> @vpperm_shuffle_unary(<16 x i8> %a0) { +; X32-LABEL: vpperm_shuffle_unary: +; X32: # BB#0: +; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_unary: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a0, <16 x i8> ) + ret <16 x i8> %1 +} + +define <16 x i8> @vpperm_shuffle_unary_undef(<16 x i8> %a0) { +; X32-LABEL: vpperm_shuffle_unary_undef: +; X32: # BB#0: +; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_unary_undef: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> undef, <16 x i8> ) + ret <16 x i8> %1 +} + +define <16 x i8> @vpperm_shuffle_unary_zero(<16 x i8> %a0) { +; X32-LABEL: vpperm_shuffle_unary_zero: +; X32: # BB#0: +; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3],zero,xmm0[1],zero +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_unary_zero: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3],zero,xmm0[1],zero +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a0, <16 x i8> ) + ret <16 x i8> %1 +} + +define <16 x i8> @vpperm_shuffle_binary(<16 x i8> %a0, <16 x i8> %a1) { +; X32-LABEL: vpperm_shuffle_binary: +; X32: # BB#0: +; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm1[15],xmm0[14],xmm1[13],xmm0[12],xmm1[11],xmm0[10],xmm1[9],xmm0[8],xmm1[7],xmm0[6],xmm1[5],xmm0[4],xmm1[3],xmm0[2],xmm1[1],xmm0[0] +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_binary: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm1[15],xmm0[14],xmm1[13],xmm0[12],xmm1[11],xmm0[10],xmm1[9],xmm0[8],xmm1[7],xmm0[6],xmm1[5],xmm0[4],xmm1[3],xmm0[2],xmm1[1],xmm0[0] +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> ) + ret <16 x i8> %1 +} + +define <16 x i8> @vpperm_shuffle_binary_zero(<16 x i8> %a0, <16 x i8> %a1) { +; X32-LABEL: vpperm_shuffle_binary_zero: +; X32: # BB#0: +; X32-NEXT: vpperm {{.*#+}} xmm0 = xmm1[15],xmm0[14],xmm1[13],xmm0[12],xmm1[11],xmm0[10],xmm1[9],xmm0[8],xmm1[7],xmm0[6],xmm1[5],xmm0[4],zero,zero,zero,zero +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_binary_zero: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*#+}} xmm0 = xmm1[15],xmm0[14],xmm1[13],xmm0[12],xmm1[11],xmm0[10],xmm1[9],xmm0[8],xmm1[7],xmm0[6],xmm1[5],xmm0[4],zero,zero,zero,zero +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a1, <16 x i8> ) + ret <16 x i8> %1 +} + +; we can't decode vpperm's other permute ops +define <16 x i8> @vpperm_shuffle_general(<16 x i8> %a0, <16 x i8> %a1) { +; X32-LABEL: vpperm_shuffle_general: +; X32: # BB#0: +; X32-NEXT: vpperm .LCPI5_0, %xmm0, %xmm0, %xmm0 +; X32-NEXT: retl +; +; X64-LABEL: vpperm_shuffle_general: +; X64: # BB#0: +; X64-NEXT: vpperm {{.*}}(%rip), %xmm0, %xmm0, %xmm0 +; X64-NEXT: retq + %1 = tail call <16 x i8> @llvm.x86.xop.vpperm(<16 x i8> %a0, <16 x i8> %a0, <16 x i8> ) + ret <16 x i8> %1 +} + +; +; VPERMIL2 +; + +declare <2 x double> @llvm.x86.xop.vpermil2pd(<2 x double>, <2 x double>, <2 x double>, i8) nounwind readnone +declare <4 x double> @llvm.x86.xop.vpermil2pd.256(<4 x double>, <4 x double>, <4 x double>, i8) nounwind readnone + +declare <4 x float> @llvm.x86.xop.vpermil2ps(<4 x float>, <4 x float>, <4 x float>, i8) nounwind readnone +declare <8 x float> @llvm.x86.xop.vpermil2ps.256(<8 x float>, <8 x float>, <8 x float>, i8) nounwind readnone + +declare <16 x i8> @llvm.x86.xop.vpperm(<16 x i8>, <16 x i8>, <16 x i8>) nounwind readnone