1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -slp-vectorizer -S -mtriple=x86_64-unknown-linux -slp-threshold=-1 | FileCheck %s
4 define i32 @diamond_broadcast(i32* noalias nocapture %B, i32* noalias nocapture %A) {
5 ; CHECK-LABEL: @diamond_broadcast(
7 ; CHECK-NEXT: [[LD:%.*]] = load i32, i32* [[A:%.*]], align 4
8 ; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], i64 1
9 ; CHECK-NEXT: [[ARRAYIDX15:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 2
10 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x i32> poison, i32 [[LD]], i32 0
11 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP0]], <4 x i32> poison, <4 x i32> zeroinitializer
12 ; CHECK-NEXT: [[TMP1:%.*]] = mul <4 x i32> [[SHUFFLE]], [[SHUFFLE]]
13 ; CHECK-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i32, i32* [[B]], i64 3
14 ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32* [[B]] to <4 x i32>*
15 ; CHECK-NEXT: store <4 x i32> [[TMP1]], <4 x i32>* [[TMP2]], align 4
16 ; CHECK-NEXT: ret i32 0
19 %ld = load i32, i32* %A, align 4
20 %mul = mul i32 %ld, %ld
21 store i32 %mul, i32* %B, align 4
22 %mul8 = mul i32 %ld, %ld
23 %arrayidx9 = getelementptr inbounds i32, i32* %B, i64 1
24 store i32 %mul8, i32* %arrayidx9, align 4
25 %mul14 = mul i32 %ld, %ld
26 %arrayidx15 = getelementptr inbounds i32, i32* %B, i64 2
27 store i32 %mul14, i32* %arrayidx15, align 4
28 %mul20 = mul i32 %ld, %ld
29 %arrayidx21 = getelementptr inbounds i32, i32* %B, i64 3
30 store i32 %mul20, i32* %arrayidx21, align 4