Files
clang-p2996/llvm/test/Transforms/SLPVectorizer/X86/broadcast_long.ll
Alexey Bataev b505fd559d [SLP]Redesign vectorization of the gather nodes.
Gather nodes are vectorized as simply vector of the scalars instead of
relying on the actual node. It leads to the fact that in some cases
we may miss incorrect transformation (non-matching set of scalars is
just ended as a gather node instead of possible vector/gather node).
Better to rely on the actual nodes, it allows to improve stability and
better detect missed cases.

Differential Revision: https://reviews.llvm.org/D135174
2022-11-10 10:59:54 -08:00

49 lines
2.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux -mcpu=corei7-avx -pass-remarks-output=%t < %s | FileCheck %s
; RUN: FileCheck %s --input-file=%t --check-prefix=YAML
; YAML-LABEL: --- !Passed
; YAML-NEXT: Pass: slp-vectorizer
; YAML-NEXT: Name: StoresVectorized
; YAML-NEXT: Function: bcast_long
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'Stores SLP vectorized with cost '
; YAML-NEXT: - Cost: '-4'
; YAML-NEXT: - String: ' and with tree size '
; YAML-NEXT: - TreeSize: '2'
define void @bcast_long(i32 *%A, i32 *%S) {
; CHECK-LABEL: @bcast_long(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[A0:%.*]] = load i32, i32* [[A:%.*]], align 8
; CHECK-NEXT: [[IDXS0:%.*]] = getelementptr inbounds i32, i32* [[S:%.*]], i64 0
; CHECK-NEXT: [[TMP0:%.*]] = insertelement <8 x i32> poison, i32 [[A0]], i32 0
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> poison, <8 x i32> <i32 0, i32 0, i32 undef, i32 0, i32 0, i32 0, i32 0, i32 0>
; CHECK-NEXT: [[TMP1:%.*]] = freeze <8 x i32> [[SHUFFLE]]
; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[IDXS0]] to <8 x i32>*
; CHECK-NEXT: store <8 x i32> [[TMP1]], <8 x i32>* [[TMP2]], align 8
; CHECK-NEXT: ret void
;
entry:
%A0 = load i32, i32 *%A, align 8
%idxS0 = getelementptr inbounds i32, i32* %S, i64 0
%idxS1 = getelementptr inbounds i32, i32* %S, i64 1
%idxS2 = getelementptr inbounds i32, i32* %S, i64 2
%idxS3 = getelementptr inbounds i32, i32* %S, i64 3
%idxS4 = getelementptr inbounds i32, i32* %S, i64 4
%idxS5 = getelementptr inbounds i32, i32* %S, i64 5
%idxS6 = getelementptr inbounds i32, i32* %S, i64 6
%idxS7 = getelementptr inbounds i32, i32* %S, i64 7
store i32 %A0, i32 *%idxS0, align 8
store i32 %A0, i32 *%idxS1, align 8
store i32 undef, i32 *%idxS2, align 8
store i32 %A0, i32 *%idxS3, align 8
store i32 %A0, i32 *%idxS4, align 8
store i32 %A0, i32 *%idxS5, align 8
store i32 %A0, i32 *%idxS6, align 8
store i32 %A0, i32 *%idxS7, align 8
ret void
}