[llvm] a9196db - [X86][AVX] Add example of failure to remove a 256-bit permute(hadd(hadd(),hadd())) shuffle by reordering the packed operands.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon May 10 10:47:58 PDT 2021


Author: Simon Pilgrim
Date: 2021-05-10T18:43:17+01:00
New Revision: a9196db905aaa35599ecd70e9f33d276bff355bb

URL: https://github.com/llvm/llvm-project/commit/a9196db905aaa35599ecd70e9f33d276bff355bb
DIFF: https://github.com/llvm/llvm-project/commit/a9196db905aaa35599ecd70e9f33d276bff355bb.diff

LOG: [X86][AVX] Add example of failure to remove a 256-bit permute(hadd(hadd(),hadd())) shuffle by reordering the packed operands.

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/horizontal-shuffle-4.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/horizontal-shuffle-4.ll b/llvm/test/CodeGen/X86/horizontal-shuffle-4.ll
index e2876e8d93f4..eab4de25959e 100644
--- a/llvm/test/CodeGen/X86/horizontal-shuffle-4.ll
+++ b/llvm/test/CodeGen/X86/horizontal-shuffle-4.ll
@@ -2,6 +2,10 @@
 ; RUN: llc < %s -mtriple=i686-apple-darwin -mattr=+avx2 | FileCheck %s
 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx2 | FileCheck %s
 
+;
+; 128-bit Vectors
+;
+
 define <16 x i8> @permute_packss_packss_128(<4 x i32> %a0, <4 x i32> %a1, <4 x i32> %a2, <4 x i32> %a3) {
 ; CHECK-LABEL: permute_packss_packss_128:
 ; CHECK:       ## %bb.0:
@@ -32,6 +36,27 @@ define <16 x i8> @permute_packss_packus_128(<4 x i32> %a0, <4 x i32> %a1, <4 x i
   ret <16 x i8> %4
 }
 
+;
+; 256-bit Vectors
+;
+
+define <8 x float> @permute_hadd_hadd_256(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2, <8 x float> %a3) {
+; CHECK-LABEL: permute_hadd_hadd_256:
+; CHECK:       ## %bb.0:
+; CHECK-NEXT:    vhaddps %ymm1, %ymm0, %ymm0
+; CHECK-NEXT:    vhaddps %ymm3, %ymm2, %ymm1
+; CHECK-NEXT:    vhaddps %ymm1, %ymm0, %ymm0
+; CHECK-NEXT:    vpermilps {{.*#+}} ymm0 = ymm0[1,2,3,0,5,6,7,4]
+; CHECK-NEXT:    ret{{[l|q]}}
+  %1 = call <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float> %a0, <8 x float> %a1)
+  %2 = call <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float> %a2, <8 x float> %a3)
+  %3 = call <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float> %1, <8 x float> %2)
+  %4 = shufflevector <8 x float> %3, <8 x float> poison, <8 x i32> <i32 1, i32 2, i32 3, i32 0, i32 5, i32 6, i32 7, i32 4>
+  ret <8 x float> %4
+}
+
+declare <8 x float> @llvm.x86.avx.hadd.ps.256(<8 x float>, <8 x float>)
+
 declare <16 x i8> @llvm.x86.sse2.packsswb.128(<8 x i16>, <8 x i16>)
 declare <8 x i16> @llvm.x86.sse2.packssdw.128(<4 x i32>, <4 x i32>)
 declare <16 x i8> @llvm.x86.sse2.packuswb.128(<8 x i16>, <8 x i16>)


        


More information about the llvm-commits mailing list