From: Simon Pilgrim Date: Thu, 31 Jan 2019 13:32:09 +0000 (+0000) Subject: [X86][AVX] Add PR34394 subvector broadcast test cases X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9dd06c1d78fa2ef8f46e61f66745af12a7d8c2ac;p=llvm [X86][AVX] Add PR34394 subvector broadcast test cases Tidyup check-prefixes at the same time git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352749 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/subvector-broadcast.ll b/test/CodeGen/X86/subvector-broadcast.ll index a05288ac031..f72d9ba7125 100644 --- a/test/CodeGen/X86/subvector-broadcast.ll +++ b/test/CodeGen/X86/subvector-broadcast.ll @@ -1,14 +1,14 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=X32 --check-prefix=X32-AVX --check-prefix=X32-AVX1 -; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X32 --check-prefix=X32-AVX --check-prefix=X32-AVX2 -; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefix=X32 --check-prefix=X32-AVX512 --check-prefix=X32-AVX512F -; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefix=X32 --check-prefix=X32-AVX512 --check-prefix=X32-AVX512BW -; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512dq,+avx512vl | FileCheck %s --check-prefix=X32 --check-prefix=X32-AVX512 --check-prefix=X32-AVX512DQ -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX --check-prefix=X64-AVX1 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX --check-prefix=X64-AVX2 -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX512 --check-prefix=X64-AVX512F -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX512 --check-prefix=X64-AVX512BW -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl | FileCheck %s --check-prefix=X64 --check-prefix=X64-AVX512 --check-prefix=X64-AVX512DQ +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=X32,X32-AVX,X32-AVX1 +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X32,X32-AVX,X32-AVX2 +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefixes=X32,X32-AVX512,X32-AVX512F +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefixes=X32,X32-AVX512,X32-AVX512BW +; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X32,X32-AVX512,X32-AVX512DQ +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=X64,X64-AVX,X64-AVX1 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=X64,X64-AVX,X64-AVX2 +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefixes=X64,X64-AVX512,X64-AVX512F +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefixes=X64,X64-AVX512,X64-AVX512BW +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64,X64-AVX512,X64-AVX512DQ ; ; Subvector Load + Broadcast @@ -1550,3 +1550,124 @@ define <64 x i8> @reg_broadcast_32i8_64i8(<32 x i8> %a0) nounwind { %1 = shufflevector <32 x i8> %a0, <32 x i8> undef, <64 x i32> ret <64 x i8> %1 } + +; +; PR34394 +; + +define <4 x i32> @test_2xi32_to_4xi32_mem(<2 x i32>* %vp) { +; X32-LABEL: test_2xi32_to_4xi32_mem: +; X32: # %bb.0: +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X32-NEXT: retl +; +; X64-AVX1-LABEL: test_2xi32_to_4xi32_mem: +; X64-AVX1: # %bb.0: +; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X64-AVX1-NEXT: retq +; +; X64-AVX2-LABEL: test_2xi32_to_4xi32_mem: +; X64-AVX2: # %bb.0: +; X64-AVX2-NEXT: vpbroadcastq (%rdi), %xmm0 +; X64-AVX2-NEXT: retq +; +; X64-AVX512-LABEL: test_2xi32_to_4xi32_mem: +; X64-AVX512: # %bb.0: +; X64-AVX512-NEXT: vpbroadcastq (%rdi), %xmm0 +; X64-AVX512-NEXT: retq + %vec = load <2 x i32>, <2 x i32>* %vp + %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <4 x i32> + ret <4 x i32> %res +} + +define <8 x i32> @test_2xi32_to_8xi32_mem(<2 x i32>* %vp) { +; X32-AVX1-LABEL: test_2xi32_to_8xi32_mem: +; X32-AVX1: # %bb.0: +; X32-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX1-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X32-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0 +; X32-AVX1-NEXT: retl +; +; X32-AVX2-LABEL: test_2xi32_to_8xi32_mem: +; X32-AVX2: # %bb.0: +; X32-AVX2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX2-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero +; X32-AVX2-NEXT: vbroadcastsd %xmm0, %ymm0 +; X32-AVX2-NEXT: retl +; +; X32-AVX512-LABEL: test_2xi32_to_8xi32_mem: +; X32-AVX512: # %bb.0: +; X32-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX512-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero +; X32-AVX512-NEXT: vbroadcastsd %xmm0, %ymm0 +; X32-AVX512-NEXT: retl +; +; X64-AVX1-LABEL: test_2xi32_to_8xi32_mem: +; X64-AVX1: # %bb.0: +; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X64-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0 +; X64-AVX1-NEXT: retq +; +; X64-AVX2-LABEL: test_2xi32_to_8xi32_mem: +; X64-AVX2: # %bb.0: +; X64-AVX2-NEXT: vbroadcastsd (%rdi), %ymm0 +; X64-AVX2-NEXT: retq +; +; X64-AVX512-LABEL: test_2xi32_to_8xi32_mem: +; X64-AVX512: # %bb.0: +; X64-AVX512-NEXT: vbroadcastsd (%rdi), %ymm0 +; X64-AVX512-NEXT: retq + %vec = load <2 x i32>, <2 x i32>* %vp + %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <8 x i32> + ret <8 x i32> %res +} + +define <16 x i32> @test_2xi32_to_16xi32_mem(<2 x i32>* %vp) { +; X32-AVX1-LABEL: test_2xi32_to_16xi32_mem: +; X32-AVX1: # %bb.0: +; X32-AVX1-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX1-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X32-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0 +; X32-AVX1-NEXT: vmovaps %ymm0, %ymm1 +; X32-AVX1-NEXT: retl +; +; X32-AVX2-LABEL: test_2xi32_to_16xi32_mem: +; X32-AVX2: # %bb.0: +; X32-AVX2-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX2-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero +; X32-AVX2-NEXT: vbroadcastsd %xmm0, %ymm0 +; X32-AVX2-NEXT: vmovaps %ymm0, %ymm1 +; X32-AVX2-NEXT: retl +; +; X32-AVX512-LABEL: test_2xi32_to_16xi32_mem: +; X32-AVX512: # %bb.0: +; X32-AVX512-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-AVX512-NEXT: vpmovzxdq {{.*#+}} xmm0 = mem[0],zero,mem[1],zero +; X32-AVX512-NEXT: vmovdqa64 {{.*#+}} zmm1 = [0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2] +; X32-AVX512-NEXT: vpermd %zmm0, %zmm1, %zmm0 +; X32-AVX512-NEXT: retl +; +; X64-AVX1-LABEL: test_2xi32_to_16xi32_mem: +; X64-AVX1: # %bb.0: +; X64-AVX1-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0] +; X64-AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0 +; X64-AVX1-NEXT: vmovaps %ymm0, %ymm1 +; X64-AVX1-NEXT: retq +; +; X64-AVX2-LABEL: test_2xi32_to_16xi32_mem: +; X64-AVX2: # %bb.0: +; X64-AVX2-NEXT: vbroadcastsd (%rdi), %ymm0 +; X64-AVX2-NEXT: vmovaps %ymm0, %ymm1 +; X64-AVX2-NEXT: retq +; +; X64-AVX512-LABEL: test_2xi32_to_16xi32_mem: +; X64-AVX512: # %bb.0: +; X64-AVX512-NEXT: vpmovzxdq {{.*#+}} xmm0 = mem[0],zero,mem[1],zero +; X64-AVX512-NEXT: vmovdqa64 {{.*#+}} zmm1 = [0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2] +; X64-AVX512-NEXT: vpermd %zmm0, %zmm1, %zmm0 +; X64-AVX512-NEXT: retq + %vec = load <2 x i32>, <2 x i32>* %vp + %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <16 x i32> + ret <16 x i32> %res +}