From: Simon Pilgrim Date: Sat, 17 Sep 2016 17:42:15 +0000 (+0000) Subject: [X86][AVX2] Add target shuffle constant folding tests X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db0c416394e9913c6a8e92b891d8b3b7ea01039f;p=llvm [X86][AVX2] Add target shuffle constant folding tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281830 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/vector-shuffle-combining-avx2.ll b/test/CodeGen/X86/vector-shuffle-combining-avx2.ll index 9340b3f6324..d2d5da4596e 100644 --- a/test/CodeGen/X86/vector-shuffle-combining-avx2.ll +++ b/test/CodeGen/X86/vector-shuffle-combining-avx2.ll @@ -346,3 +346,33 @@ define <32 x i8> @combine_pshufb_not_as_pshufw(<32 x i8> %a0) { %res1 = call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> %res0, <32 x i8> ) ret <32 x i8> %res1 } + +define <8 x i32> @constant_fold_permd() { +; CHECK-LABEL: constant_fold_permd: +; CHECK: # BB#0: +; CHECK-NEXT: vmovdqa {{.*#+}} ymm0 = [4,6,2,1,7,1,5,0] +; CHECK-NEXT: vpermd {{.*}}(%rip), %ymm0, %ymm0 +; CHECK-NEXT: retq + %1 = call <8 x i32> @llvm.x86.avx2.permd(<8 x i32> , <8 x i32> ) + ret <8 x i32> %1 +} + +define <8 x float> @constant_fold_permps() { +; CHECK-LABEL: constant_fold_permps: +; CHECK: # BB#0: +; CHECK-NEXT: vmovaps {{.*#+}} ymm0 = [4,6,2,1,7,1,5,0] +; CHECK-NEXT: vpermps {{.*}}(%rip), %ymm0, %ymm0 +; CHECK-NEXT: retq + %1 = call <8 x float> @llvm.x86.avx2.permps(<8 x float> , <8 x i32> ) + ret <8 x float> %1 +} + +define <32 x i8> @constant_fold_pshufb_256() { +; CHECK-LABEL: constant_fold_pshufb_256: +; CHECK: # BB#0: +; CHECK-NEXT: vmovdqa {{.*#+}} ymm0 = [15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0,255,254,253,252,251,250,249,248,247,246,245,244,243,242,241] +; CHECK-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[1],zero,zero,zero,ymm0[u,u],zero,zero,ymm0[15],zero,zero,zero,zero,zero,ymm0[7,6,17],zero,zero,zero,ymm0[u,u],zero,zero,ymm0[31],zero,zero,zero,zero,zero,ymm0[23,22] +; CHECK-NEXT: retq + %1 = tail call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> , <32 x i8> ) + ret <32 x i8> %1 +}