[llvm] 7510641 - [SLP][NFC]Add a test for extractelements with many uses vectorization, NFC.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 06:31:41 PST 2021
Author: Alexey Bataev
Date: 2021-12-02T06:30:37-08:00
New Revision: 75106413d0802982b208ab5adf22c4c45766f0c2
URL: https://github.com/llvm/llvm-project/commit/75106413d0802982b208ab5adf22c4c45766f0c2
DIFF: https://github.com/llvm/llvm-project/commit/75106413d0802982b208ab5adf22c4c45766f0c2.diff
LOG: [SLP][NFC]Add a test for extractelements with many uses vectorization, NFC.
Added:
llvm/test/Transforms/SLPVectorizer/X86/extractelement-multiple-uses.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/extractelement-multiple-uses.ll b/llvm/test/Transforms/SLPVectorizer/X86/extractelement-multiple-uses.ll
new file mode 100644
index 000000000000..c47f255f0bfe
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/extractelement-multiple-uses.ll
@@ -0,0 +1,32 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-unknown-linux -march=core-avx2 -pass-remarks-output=%t | FileCheck %s
+; RUN: FileCheck %s --input-file=%t --check-prefix=YAML
+
+; YAML: --- !Missed
+; YAML: Pass: slp-vectorizer
+; YAML: Name: NotBeneficial
+; YAML: Function: multi_uses
+; YAML: Args:
+; YAML: - String: 'List vectorization was possible but not beneficial with cost '
+; YAML: - Cost: '0'
+; YAML: - String: ' >= '
+; YAML: - Treshold: '0'
+
+define float @multi_uses(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @multi_uses(
+; CHECK-NEXT: [[X0:%.*]] = extractelement <2 x float> [[X:%.*]], i32 0
+; CHECK-NEXT: [[X1:%.*]] = extractelement <2 x float> [[X]], i32 1
+; CHECK-NEXT: [[Y1:%.*]] = extractelement <2 x float> [[Y:%.*]], i32 1
+; CHECK-NEXT: [[X0X0:%.*]] = fmul float [[X0]], [[Y1]]
+; CHECK-NEXT: [[X1X1:%.*]] = fmul float [[X1]], [[Y1]]
+; CHECK-NEXT: [[ADD:%.*]] = fadd float [[X0X0]], [[X1X1]]
+; CHECK-NEXT: ret float [[ADD]]
+;
+ %x0 = extractelement <2 x float> %x, i32 0
+ %x1 = extractelement <2 x float> %x, i32 1
+ %y1 = extractelement <2 x float> %y, i32 1
+ %x0x0 = fmul float %x0, %y1
+ %x1x1 = fmul float %x1, %y1
+ %add = fadd float %x0x0, %x1x1
+ ret float %add
+}
More information about the llvm-commits
mailing list