From f4ee49f32f0088f8aaede54ec6cdc0737e0cbc3c Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 29 Nov 2016 13:16:11 +0000 Subject: [PATCH] [X86][SSE] Added tests showing missed combines to (V)PMOVZX git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288136 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../X86/vector-shuffle-combining-avx2.ll | 38 +++++++++++++++++++ .../X86/vector-shuffle-combining-ssse3.ll | 15 ++++++++ 2 files changed, 53 insertions(+) diff --git a/test/CodeGen/X86/vector-shuffle-combining-avx2.ll b/test/CodeGen/X86/vector-shuffle-combining-avx2.ll index 396d6a34156..8c5e7b4c40c 100644 --- a/test/CodeGen/X86/vector-shuffle-combining-avx2.ll +++ b/test/CodeGen/X86/vector-shuffle-combining-avx2.ll @@ -447,6 +447,44 @@ define <8 x float> @combine_permps_as_permpd(<8 x float> %a) { ret <8 x float> %1 } +define <4 x i64> @combine_pshufb_as_zext(<32 x i8> %a0) { +; X32-LABEL: combine_pshufb_as_zext: +; X32: # BB#0: +; X32-NEXT: vpermq {{.*#+}} ymm0 = ymm0[1,0,0,1] +; X32-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9],zero,zero,zero,zero,zero,zero,ymm0[10,11],zero,zero,zero,zero,zero,zero,ymm0[20,21],zero,zero,zero,zero,zero,zero,ymm0[22,23],zero,zero,zero,zero,zero,zero +; X32-NEXT: retl +; +; X64-LABEL: combine_pshufb_as_zext: +; X64: # BB#0: +; X64-NEXT: vpermq {{.*#+}} ymm0 = ymm0[1,0,0,1] +; X64-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9],zero,zero,zero,zero,zero,zero,ymm0[10,11],zero,zero,zero,zero,zero,zero,ymm0[20,21],zero,zero,zero,zero,zero,zero,ymm0[22,23],zero,zero,zero,zero,zero,zero +; X64-NEXT: retq + %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> + %2 = call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> %1, <32 x i8> ) + %3 = bitcast <32 x i8> %2 to <4 x i64> + ret <4 x i64> %3 +} + +define <4 x i64> @combine_pshufb_as_zext128(<32 x i8> %a0) { +; X32-LABEL: combine_pshufb_as_zext128: +; X32: # BB#0: +; X32-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X32-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,1,0,1] +; X32-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[15,14],zero,zero,zero,zero,zero,zero,ymm0[13,12],zero,zero,zero,zero,zero,zero,ymm0[31,30],zero,zero,zero,zero,zero,zero,ymm0[29,28],zero,zero,zero,zero,zero,zero +; X32-NEXT: retl +; +; X64-LABEL: combine_pshufb_as_zext128: +; X64: # BB#0: +; X64-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0] +; X64-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[0,1,0,1] +; X64-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[15,14],zero,zero,zero,zero,zero,zero,ymm0[13,12],zero,zero,zero,zero,zero,zero,ymm0[31,30],zero,zero,zero,zero,zero,zero,ymm0[29,28],zero,zero,zero,zero,zero,zero +; X64-NEXT: retq + %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <32 x i32> + %2 = call <32 x i8> @llvm.x86.avx2.pshuf.b(<32 x i8> %1, <32 x i8> ) + %3 = bitcast <32 x i8> %2 to <4 x i64> + ret <4 x i64> %3 +} + define <4 x double> @combine_pshufb_as_vzmovl_64(<4 x double> %a0) { ; X32-LABEL: combine_pshufb_as_vzmovl_64: ; X32: # BB#0: diff --git a/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll b/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll index 4e93c6e3b0c..3e2a8c48689 100644 --- a/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll +++ b/test/CodeGen/X86/vector-shuffle-combining-ssse3.ll @@ -105,6 +105,21 @@ define <4 x float> @combine_pshufb_as_movss(<4 x float> %a0, <4 x float> %a1) { ret <4 x float> %4 } +define <4 x i32> @combine_pshufb_as_zext(<16 x i8> %a0) { +; SSE-LABEL: combine_pshufb_as_zext: +; SSE: # BB#0: +; SSE-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero +; SSE-NEXT: retq +; +; AVX-LABEL: combine_pshufb_as_zext: +; AVX: # BB#0: +; AVX-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero +; AVX-NEXT: retq + %1 = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> %a0, <16 x i8> ) + %2 = bitcast <16 x i8> %1 to <4 x i32> + ret <4 x i32> %2 +} + define <2 x double> @combine_pshufb_as_vzmovl_64(<2 x double> %a0) { ; SSE-LABEL: combine_pshufb_as_vzmovl_64: ; SSE: # BB#0: -- 2.50.1