[SLP][NFC]Add a test for broadcast cost with undefs, NFC.

This commit is contained in:
Alexey Bataev 2021-12-15 05:57:58 -08:00
parent 517f1d9e5c
commit 46bbd254c1
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -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: '-5'
; 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: [[IDXS1:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 1
; CHECK-NEXT: [[IDXS2:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 2
; CHECK-NEXT: [[IDXS3:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 3
; CHECK-NEXT: [[IDXS4:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 4
; CHECK-NEXT: [[IDXS5:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 5
; CHECK-NEXT: [[IDXS6:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 6
; CHECK-NEXT: [[IDXS7:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 7
; 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:%.*]] = bitcast i32* [[IDXS0]] to <8 x i32>*
; CHECK-NEXT: store <8 x i32> [[SHUFFLE]], <8 x i32>* [[TMP1]], 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
}