diff options
author | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2012-06-26 08:04:10 +0000 |
---|---|---|
committer | Elena Demikhovsky <elena.demikhovsky@intel.com> | 2012-06-26 08:04:10 +0000 |
commit | 1596373671e4df54e53e79dc613545d5cf9d83bb (patch) | |
tree | 247c03124f7e2faf9fb64885e7f2b3d952f41cb3 /test | |
parent | c04f816afd1ad9a1c3746f894556b6bea0cac8fc (diff) | |
download | external_llvm-1596373671e4df54e53e79dc613545d5cf9d83bb.zip external_llvm-1596373671e4df54e53e79dc613545d5cf9d83bb.tar.gz external_llvm-1596373671e4df54e53e79dc613545d5cf9d83bb.tar.bz2 |
Shuffle optimization for AVX/AVX2.
The current patch optimizes frequently used shuffle patterns and gives these instruction sequence reduction.
Before:
vshufps $-35, %xmm1, %xmm0, %xmm2 ## xmm2 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm2, %xmm2 ## xmm2 = xmm2[0,2,1,3]
vextractf128 $1, %ymm1, %xmm1
vextractf128 $1, %ymm0, %xmm0
vshufps $-35, %xmm1, %xmm0, %xmm0 ## xmm0 = xmm0[1,3],xmm1[1,3]
vpermilps $-40, %xmm0, %xmm0 ## xmm0 = xmm0[0,2,1,3]
vinsertf128 $1, %xmm0, %ymm2, %ymm0
After:
vshufps $13, %ymm0, %ymm1, %ymm1 ## ymm1 = ymm1[1,3],ymm0[0,0],ymm1[5,7],ymm0[4,4]
vshufps $13, %ymm0, %ymm0, %ymm0 ## ymm0 = ymm0[1,3,0,0,5,7,4,4]
vunpcklps %ymm1, %ymm0, %ymm0 ## ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/X86/avx-shuffle.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/X86/avx-shuffle.ll b/test/CodeGen/X86/avx-shuffle.ll index a88b0b9..9b41709 100644 --- a/test/CodeGen/X86/avx-shuffle.ll +++ b/test/CodeGen/X86/avx-shuffle.ll @@ -227,3 +227,24 @@ define <8 x float> @test17(<4 x float> %y) { %x = shufflevector <4 x float> %y, <4 x float> undef, <8 x i32> <i32 undef, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef> ret <8 x float> %x } + +; CHECK: test18 +; CHECK: vshufps +; CHECK: vshufps +; CHECK: vunpcklps +; CHECK: ret +define <8 x float> @test18(<8 x float> %A, <8 x float>%B) nounwind { + %S = shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15> + ret <8 x float>%S +} + +; CHECK: test19 +; CHECK: vshufps +; CHECK: vshufps +; CHECK: vunpcklps +; CHECK: ret +define <8 x float> @test19(<8 x float> %A, <8 x float>%B) nounwind { + %S = shufflevector <8 x float> %A, <8 x float> %B, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14> + ret <8 x float>%S +} + |