[llvm] 1c7dda9 - [SLP][NFC]Add a test for non-optimal PHIs vectorization, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 15:56:27 PDT 2021


Author: Alexey Bataev
Date: 2021-08-25T15:55:11-07:00
New Revision: 1c7dda9095869a5b6e2deccc4a76f2b95a6703b7

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

LOG: [SLP][NFC]Add a test for non-optimal PHIs vectorization, NFC.

Added: 
    llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll
new file mode 100644
index 0000000000000..d2e30530a9547
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/vectorize-widest-phis.ll
@@ -0,0 +1,84 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -slp-vectorizer -S -mcpu=cascadelake -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
+
+define void @foo() {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[CONV:%.*]] = uitofp i16 undef to float
+; CHECK-NEXT:    [[SUB:%.*]] = fsub float 6.553500e+04, undef
+; CHECK-NEXT:    br label [[BB1:%.*]]
+; CHECK:       bb1:
+; CHECK-NEXT:    br label [[BB2:%.*]]
+; CHECK:       bb2:
+; CHECK-NEXT:    [[TMP0:%.*]] = phi float [ [[SUB]], [[BB1]] ], [ [[TMP9:%.*]], [[BB3:%.*]] ]
+; CHECK-NEXT:    [[TMP1:%.*]] = phi float [ [[CONV]], [[BB1]] ], [ [[TMP10:%.*]], [[BB3]] ]
+; CHECK-NEXT:    [[TMP2:%.*]] = phi <2 x float> [ undef, [[BB1]] ], [ [[TMP11:%.*]], [[BB3]] ]
+; CHECK-NEXT:    [[TMP3:%.*]] = load double, double* undef, align 8
+; CHECK-NEXT:    br i1 undef, label [[BB3]], label [[BB4:%.*]]
+; CHECK:       bb4:
+; CHECK-NEXT:    [[TMP4:%.*]] = fpext <2 x float> [[TMP2]] to <2 x double>
+; CHECK-NEXT:    [[TMP5:%.*]] = fcmp ogt <2 x double> undef, [[TMP4]]
+; CHECK-NEXT:    [[TMP6:%.*]] = select <2 x i1> [[TMP5]], <2 x float> [[TMP2]], <2 x float> undef
+; CHECK-NEXT:    [[EXT3:%.*]] = fpext float [[TMP1]] to double
+; CHECK-NEXT:    [[CONV2:%.*]] = uitofp i16 undef to double
+; CHECK-NEXT:    [[ADD1:%.*]] = fadd double [[TMP3]], [[CONV2]]
+; CHECK-NEXT:    [[CMP3:%.*]] = fcmp ogt double [[ADD1]], [[EXT3]]
+; CHECK-NEXT:    [[TMP7:%.*]] = fptrunc double [[ADD1]] to float
+; CHECK-NEXT:    [[SEL3:%.*]] = select i1 [[CMP3]], float [[TMP1]], float [[TMP7]]
+; CHECK-NEXT:    [[EXT4:%.*]] = fpext float [[TMP0]] to double
+; CHECK-NEXT:    [[SUB1:%.*]] = fsub double undef, undef
+; CHECK-NEXT:    [[CMP4:%.*]] = fcmp ogt double [[SUB1]], [[EXT4]]
+; CHECK-NEXT:    [[TMP8:%.*]] = fptrunc double [[SUB1]] to float
+; CHECK-NEXT:    [[SEL4:%.*]] = select i1 [[CMP4]], float [[TMP0]], float [[TMP8]]
+; CHECK-NEXT:    br label [[BB3]]
+; CHECK:       bb3:
+; CHECK-NEXT:    [[TMP9]] = phi float [ [[SEL4]], [[BB4]] ], [ [[TMP0]], [[BB2]] ]
+; CHECK-NEXT:    [[TMP10]] = phi float [ [[SEL3]], [[BB4]] ], [ [[TMP1]], [[BB2]] ]
+; CHECK-NEXT:    [[TMP11]] = phi <2 x float> [ [[TMP6]], [[BB4]] ], [ [[TMP2]], [[BB2]] ]
+; CHECK-NEXT:    br label [[BB2]]
+;
+entry:
+  %conv = uitofp i16 undef to float
+  %sub = fsub float 6.553500e+04, undef
+  br label %bb1
+
+bb1:
+  br label %bb2
+
+bb2:
+  %0 = phi float [ %sub, %bb1 ], [ %9, %bb3 ]
+  %1 = phi float [ %conv, %bb1 ], [ %10, %bb3 ]
+  %2 = phi float [ undef, %bb1 ], [ %11, %bb3 ]
+  %3 = phi float [ undef, %bb1 ], [ %12, %bb3 ]
+  %4 = load double, double* undef, align 8
+  br i1 undef, label %bb3, label %bb4
+
+bb4:
+  %ext = fpext float %3 to double
+  %cmp1 = fcmp ogt double undef, %ext
+  %5 = fptrunc double undef to float
+  %sel1 = select i1 %cmp1, float %3, float %5
+  %ext2 = fpext float %2 to double
+  %cmp2 = fcmp ogt double undef, %ext2
+  %6 = fptrunc double undef to float
+  %sel2 = select i1 %cmp2, float %2, float %6
+  %ext3 = fpext float %1 to double
+  %conv2 = uitofp i16 undef to double
+  %add1 = fadd double %4, %conv2
+  %cmp3 = fcmp ogt double %add1, %ext3
+  %7 = fptrunc double %add1 to float
+  %sel3 = select i1 %cmp3, float %1, float %7
+  %ext4 = fpext float %0 to double
+  %sub1 = fsub double undef, undef
+  %cmp4 = fcmp ogt double %sub1, %ext4
+  %8 = fptrunc double %sub1 to float
+  %sel4 = select i1 %cmp4, float %0, float %8
+  br label %bb3
+
+bb3:
+  %9 = phi float [ %sel4, %bb4 ], [ %0, %bb2 ]
+  %10 = phi float [ %sel3, %bb4 ], [ %1, %bb2 ]
+  %11 = phi float [ %sel2, %bb4 ], [ %2, %bb2 ]
+  %12 = phi float [ %sel1, %bb4 ], [ %3, %bb2 ]
+  br label %bb2
+}


        


More information about the llvm-commits mailing list