From fbea14f66c23bf1b1a8f99c63817f5daa5cb8be5 Mon Sep 17 00:00:00 2001 From: Elena Demikhovsky Date: Wed, 27 May 2015 14:09:33 +0000 Subject: [PATCH] AVX-512: Fixed a bug in extracting subvector from v64i1 By Igor Breger (igor.breger@intel.com) llvm-svn: 238322 --- lib/Target/X86/X86InstrAVX512.td | 8 ++++++++ test/CodeGen/X86/avx512-trunc-ext.ll | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/Target/X86/X86InstrAVX512.td b/lib/Target/X86/X86InstrAVX512.td index 8b26603e250..9d11d3c7050 100644 --- a/lib/Target/X86/X86InstrAVX512.td +++ b/lib/Target/X86/X86InstrAVX512.td @@ -1893,6 +1893,8 @@ let Predicates = [HasAVX512] in { def : Pat<(i32 (zext VK1:$src)), (AND32ri (KMOVWrk (COPY_TO_REGCLASS VK1:$src, VK16)), (i32 1))>; + def : Pat<(i32 (anyext VK1:$src)), + (KMOVWrk (COPY_TO_REGCLASS VK1:$src, VK16))>; def : Pat<(i8 (zext VK1:$src)), (EXTRACT_SUBREG (AND32ri (KMOVWrk @@ -2223,6 +2225,12 @@ def : Pat<(v16i1 (insert_subvector undef, (v8i1 VK8:$src), (iPTR 0))), def : Pat<(v8i1 (extract_subvector (v16i1 VK16:$src), (iPTR 8))), (v8i1 (COPY_TO_REGCLASS (KSHIFTRWri VK16:$src, (i8 8)), VK8))>; +def : Pat<(v32i1 (extract_subvector (v64i1 VK64:$src), (iPTR 0))), + (v32i1 (COPY_TO_REGCLASS VK64:$src, VK32))>; + +def : Pat<(v32i1 (extract_subvector (v64i1 VK64:$src), (iPTR 32))), + (v32i1 (COPY_TO_REGCLASS (KSHIFTRQri VK64:$src, (i8 32)), VK32))>; + let Predicates = [HasVLX] in { def : Pat<(v8i1 (insert_subvector undef, (v4i1 VK4:$src), (iPTR 0))), (v8i1 (COPY_TO_REGCLASS VK4:$src, VK8))>; diff --git a/test/CodeGen/X86/avx512-trunc-ext.ll b/test/CodeGen/X86/avx512-trunc-ext.ll index f5e910c4a8e..f25458972e4 100644 --- a/test/CodeGen/X86/avx512-trunc-ext.ll +++ b/test/CodeGen/X86/avx512-trunc-ext.ll @@ -950,3 +950,12 @@ define void @extload_v8i64(<8 x i8>* %a, <8 x i64>* %res) { ret void } +;SKX-LABEL: test21: +;SKX: vmovdqu16 %zmm0, %zmm3 {%k1} +;SKX-NEXT: kshiftrq $32, %k1, %k1 +;SKX-NEXT: vmovdqu16 %zmm1, %zmm2 {%k1} +define <64 x i16> @test21(<64 x i16> %x , <64 x i1> %mask) nounwind readnone { + %ret = select <64 x i1> %mask, <64 x i16> %x, <64 x i16> zeroinitializer + ret <64 x i16> %ret +} +