-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[System] Precommit of test for #112491 #113704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-backend-systemz @llvm/pr-subscribers-llvm-transforms Author: Jonas Paulsson (JonPsson1) ChangesFull diff: https://github.com/llvm/llvm-project/pull/113704.diff 1 Files Affected:
diff --git a/llvm/test/Transforms/SLPVectorizer/SystemZ/vec-elt-insertion.ll b/llvm/test/Transforms/SLPVectorizer/SystemZ/vec-elt-insertion.ll
new file mode 100644
index 00000000000000..eb8dd72e0304d9
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/SystemZ/vec-elt-insertion.ll
@@ -0,0 +1,128 @@
+; RUN: opt < %s -mtriple=s390x-unknown-linux -mcpu=z16 -S -passes=slp-vectorizer \
+; RUN: -pass-remarks-output=%t | FileCheck %s
+; RUN: cat %t | FileCheck -check-prefix=REMARK %s
+;
+; NB! This is a pre-commit version (for #112491) with current codegen and remarks.
+;
+; Test functions that (at least currently) only gets vectorized if the
+; insertion cost for an element load is counted as free.
+
+; This function needs the free element load to be recognized in SLP
+; getGatherCost().
+define void @fun0(ptr nocapture %0, double %1) {
+; CHECK-LABEL: define void @fun0(
+; CHECK: fmul double
+; CHECK: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.sqrt.f64(
+; CHECK: fmul double
+; CHECK: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.sqrt.f64(
+;
+; REMARK-LABEL: Function: fun0
+; REMARK: Args:
+; REMARK-NEXT: - String: 'List vectorization was possible but not beneficial with cost '
+; REMARK-NEXT: - Cost: '0'
+
+ %3 = fmul double %1, 2.000000e+00
+ %4 = tail call double @llvm.fmuladd.f64(double %3, double %3, double 0.000000e+00)
+ %5 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %4)
+ %sqrt1 = tail call double @llvm.sqrt.f64(double %5)
+ %6 = load double, ptr %0, align 8
+ %7 = fmul double %6, 2.000000e+00
+ %8 = tail call double @llvm.fmuladd.f64(double %7, double %7, double 0.000000e+00)
+ %9 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %8)
+ %sqrt = tail call double @llvm.sqrt.f64(double %9)
+ %10 = fadd double %sqrt1, %sqrt
+ store double %10, ptr %0, align 8
+ ret void
+}
+
+; This function needs the element-load to be recognized in SystemZ
+; getVectorInstrCost().
+define void @fun1(double %0) {
+; CHECK-LABEL: define void @fun1(
+; CHECK: phi double
+; CHECK-NEXT: phi double
+; CHECK-NEXT: phi double
+; CHECK-NEXT: phi double
+; CHECK-NEXT: phi double
+; CHECK-NEXT: phi double
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: fmul double
+; CHECK-NEXT: fmul double
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: fsub double
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK-NEXT: call double @llvm.fmuladd.f64(
+; CHECK: fcmp olt double
+; CHECK-NEXT: fcmp olt double
+; CHECK-NEXT: or i1
+;
+; REMARK-LABEL: Function: fun1
+; REMARK: Args:
+; REMARK: - String: 'List vectorization was possible but not beneficial with cost '
+; REMARK-NEXT: - Cost: '0'
+
+ br label %2
+
+2:
+ %3 = phi double [ poison, %1 ], [ poison, %2 ]
+ %4 = phi double [ undef, %1 ], [ poison, %2 ]
+ %5 = phi double [ 0.000000e+00, %1 ], [ poison, %2 ]
+ %6 = phi double [ 0.000000e+00, %1 ], [ poison, %2 ]
+ %7 = phi double [ 0.000000e+00, %1 ], [ poison, %2 ]
+ %8 = phi double [ 0.000000e+00, %1 ], [ %21, %2 ]
+ %9 = fsub double 0.000000e+00, %8
+ %10 = fsub double 0.000000e+00, %7
+ %11 = fmul double %9, 0.000000e+00
+ %12 = fmul double %10, 0.000000e+00
+ %13 = fsub double 0.000000e+00, %6
+ %14 = fsub double 0.000000e+00, %5
+ %15 = tail call double @llvm.fmuladd.f64(double %13, double %13, double %11)
+ %16 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %12)
+ %17 = fsub double 0.000000e+00, %4
+ %18 = fsub double 0.000000e+00, %3
+ %19 = tail call double @llvm.fmuladd.f64(double %17, double %17, double %15)
+ %20 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %16)
+ %21 = load double, ptr null, align 8
+ %22 = fcmp olt double %19, %0
+ %23 = fcmp olt double %20, 0.000000e+00
+ %24 = or i1 %23, %22
+ br label %2
+}
+
+declare double @llvm.fmuladd.f64(double, double, double)
+
+; This should *not* be vectorized as the insertion into the vector isn't free,
+; which is recognized in SystemZTTImpl::getScalarizationOverhead().
+define void @fun2(ptr %0, ptr %Dst) {
+; CHECK-LABEL: define void @fun2(
+; CHECK: insertelement
+; CHECK: store <2 x i64>
+;
+; REMARK-LABEL: Function: fun2
+; REMARK: Args:
+; REMARK-NEXT: - String: 'Stores SLP vectorized with cost '
+; REMARK-NEXT: - Cost: '-1'
+
+ %3 = load i64, ptr %0, align 8
+ %4 = icmp eq i64 %3, 0
+ br i1 %4, label %5, label %6
+
+5:
+ ret void
+
+6:
+ %7 = getelementptr i8, ptr %Dst, i64 24
+ store i64 %3, ptr %7, align 8
+ %8 = getelementptr i8, ptr %Dst, i64 16
+ store i64 0, ptr %8, align 8
+ br label %5
+}
|
NoumanAmir657
pushed a commit
to NoumanAmir657/llvm-project
that referenced
this pull request
Nov 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.