[llvm] 139508e - [SLP][NFC]Add a test with inefficient reordering of operands, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 12:24:25 PDT 2024


Author: Alexey Bataev
Date: 2024-07-02T12:04:34-07:00
New Revision: 139508eb87bda18c8adbfb87bba6acac8ce29a36

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

LOG: [SLP][NFC]Add a test with inefficient reordering of operands, NFC.

Added: 
    llvm/test/Transforms/SLPVectorizer/X86/reordering-single-phi.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/reordering-single-phi.ll b/llvm/test/Transforms/SLPVectorizer/X86/reordering-single-phi.ll
new file mode 100644
index 0000000000000..156ab54dbf237
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reordering-single-phi.ll
@@ -0,0 +1,80 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux < %s | FileCheck %s
+
+ at a = external global [32000 x float], align 64
+
+define void @test() {
+; CHECK-LABEL: define void @test() {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:    br label %[[FOR_BODY:.*]]
+; CHECK:       [[FOR_BODY]]:
+; CHECK-NEXT:    [[TMP0:%.*]] = phi float [ 0.000000e+00, %[[ENTRY]] ], [ [[TMP16:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY]] ]
+; CHECK-NEXT:    [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[TMP1]]
+; CHECK-NEXT:    [[TMP2:%.*]] = load float, ptr [[ARRAYIDX]], align 4
+; CHECK-NEXT:    [[ARRAYIDX6:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[INDVARS_IV]]
+; CHECK-NEXT:    [[TMP3:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 2
+; CHECK-NEXT:    [[ARRAYIDX11:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[TMP3]]
+; CHECK-NEXT:    [[TMP4:%.*]] = load <2 x float>, ptr [[ARRAYIDX11]], align 4
+; CHECK-NEXT:    [[TMP5:%.*]] = add nuw nsw i64 [[INDVARS_IV]], 4
+; CHECK-NEXT:    [[ARRAYIDX31:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[TMP5]]
+; CHECK-NEXT:    [[TMP6:%.*]] = load float, ptr [[ARRAYIDX31]], align 4
+; CHECK-NEXT:    [[TMP7:%.*]] = insertelement <4 x float> poison, float [[TMP0]], i32 0
+; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <4 x float> [[TMP7]], float [[TMP2]], i32 1
+; CHECK-NEXT:    [[TMP9:%.*]] = shufflevector <2 x float> [[TMP4]], <2 x float> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 poison>
+; CHECK-NEXT:    [[TMP10:%.*]] = shufflevector <4 x float> [[TMP8]], <4 x float> [[TMP9]], <4 x i32> <i32 0, i32 1, i32 5, i32 poison>
+; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <4 x float> [[TMP10]], float [[TMP6]], i32 3
+; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <4 x float> poison, float [[TMP2]], i32 0
+; CHECK-NEXT:    [[TMP13:%.*]] = shufflevector <4 x float> [[TMP12]], <4 x float> [[TMP9]], <4 x i32> <i32 0, i32 4, i32 poison, i32 6>
+; CHECK-NEXT:    [[TMP14:%.*]] = shufflevector <4 x float> [[TMP13]], <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 1, i32 3>
+; CHECK-NEXT:    [[TMP15:%.*]] = fmul fast <4 x float> [[TMP11]], [[TMP14]]
+; CHECK-NEXT:    store <4 x float> [[TMP15]], ptr [[ARRAYIDX6]], align 4
+; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 5
+; CHECK-NEXT:    [[ARRAYIDX41:%.*]] = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 [[INDVARS_IV_NEXT]]
+; CHECK-NEXT:    [[TMP16]] = load float, ptr [[ARRAYIDX41]], align 4
+; CHECK-NEXT:    [[MUL45:%.*]] = fmul fast float [[TMP16]], [[TMP6]]
+; CHECK-NEXT:    store float [[MUL45]], ptr [[ARRAYIDX31]], align 4
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i64 [[INDVARS_IV]], 31990
+; CHECK-NEXT:    br i1 [[CMP2]], label %[[FOR_BODY]], label %[[EXIT:.*]]
+; CHECK:       [[EXIT]]:
+; CHECK-NEXT:    ret void
+;
+entry:
+  br label %for.body
+
+for.body:
+  %0 = phi float [ 0.000000e+00, %entry ], [ %9, %for.body ]
+  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+  %1 = add nuw nsw i64 %indvars.iv, 1
+  %arrayidx = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %1
+  %2 = load float, ptr %arrayidx, align 4
+  %arrayidx6 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %indvars.iv
+  %mul = fmul fast float %0, %2
+  store float %mul, ptr %arrayidx6, align 4
+  %3 = add nuw nsw i64 %indvars.iv, 2
+  %arrayidx11 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %3
+  %4 = load float, ptr %arrayidx11, align 4
+  %mul15 = fmul fast float %4, %2
+  store float %mul15, ptr %arrayidx, align 4
+  %5 = add nuw nsw i64 %indvars.iv, 3
+  %arrayidx21 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %5
+  %6 = load float, ptr %arrayidx21, align 4
+  %mul25 = fmul fast float %6, %4
+  store float %mul25, ptr %arrayidx11, align 4
+  %7 = add nuw nsw i64 %indvars.iv, 4
+  %arrayidx31 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %7
+  %8 = load float, ptr %arrayidx31, align 4
+  %mul35 = fmul fast float %8, %6
+  store float %mul35, ptr %arrayidx21, align 4
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
+  %arrayidx41 = getelementptr inbounds [32000 x float], ptr @a, i64 0, i64 %indvars.iv.next
+  %9 = load float, ptr %arrayidx41, align 4
+  %mul45 = fmul fast float %9, %8
+  store float %mul45, ptr %arrayidx31, align 4
+  %cmp2 = icmp ult i64 %indvars.iv, 31990
+  br i1 %cmp2, label %for.body, label %exit
+
+exit:
+  ret void
+}


        


More information about the llvm-commits mailing list