[llvm] ecc204b - [SLP][NFC]Add a test with an extra cost of the reused extractelement
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 13:29:49 PDT 2023
Author: Alexey Bataev
Date: 2023-04-20T13:27:48-07:00
New Revision: ecc204b64e98d1c3b6f2064af0eac4ec9a920f86
URL: https://github.com/llvm/llvm-project/commit/ecc204b64e98d1c3b6f2064af0eac4ec9a920f86
DIFF: https://github.com/llvm/llvm-project/commit/ecc204b64e98d1c3b6f2064af0eac4ec9a920f86.diff
LOG: [SLP][NFC]Add a test with an extra cost of the reused extractelement
instruction, NFC.
Added:
llvm/test/Transforms/SLPVectorizer/X86/reused-extractelements.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/reused-extractelements.ll b/llvm/test/Transforms/SLPVectorizer/X86/reused-extractelements.ll
new file mode 100644
index 000000000000..216db4b43325
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/reused-extractelements.ll
@@ -0,0 +1,30 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=slp-vectorizer -S -o - -mtriple=x86_64-unknown-linux -mcpu=bdver2 -pass-remarks-output=%t | FileCheck %s
+; RUN: FileCheck --input-file=%t --check-prefix=YAML %s
+
+; YAML: --- !Passed
+; YAML-NEXT: Pass: slp-vectorizer
+; YAML-NEXT: Name: VectorizedList
+; YAML-NEXT: Function: g
+; YAML-NEXT: Args:
+; YAML-NEXT: - String: 'SLP vectorized with cost '
+; YAML-NEXT: - Cost: '-2'
+; YAML-NEXT: - String: ' and with tree size '
+; YAML-NEXT: - TreeSize: '4'
+
+define <2 x i32> @g(<2 x i32> %x, i32 %a, i32 %b) {
+; CHECK-LABEL: @g(
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i32> [[X:%.*]], <2 x i32> poison, <2 x i32> <i32 1, i32 undef>
+; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[A:%.*]], i32 1
+; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[B:%.*]], i32 1
+; CHECK-NEXT: [[TMP4:%.*]] = mul <2 x i32> [[TMP2]], [[TMP3]]
+; CHECK-NEXT: ret <2 x i32> [[TMP4]]
+;
+ %x1 = extractelement <2 x i32> %x, i32 1
+ %x1x1 = mul i32 %x1, %x1
+ %ab = mul i32 %a, %b
+ %ins1 = insertelement <2 x i32> poison, i32 %x1x1, i32 0
+ %ins2 = insertelement <2 x i32> %ins1, i32 %ab, i32 1
+ ret <2 x i32> %ins2
+}
+
More information about the llvm-commits
mailing list