1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 < %s | FileCheck %s
4 ; Function Attrs: nounwind uwtable
5 define void @get_block(i32 %y_pos) local_unnamed_addr #0 {
6 ; CHECK-LABEL: @get_block(
8 ; CHECK-NEXT: br label [[LAND_LHS_TRUE:%.*]]
9 ; CHECK: land.lhs.true:
10 ; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_END:%.*]]
12 ; CHECK-NEXT: unreachable
14 ; CHECK-NEXT: [[SUB14:%.*]] = sub nsw i32 [[Y_POS:%.*]], undef
15 ; CHECK-NEXT: [[SHR15:%.*]] = ashr i32 [[SUB14]], 2
16 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> undef, i32 [[SHR15]], i32 0
17 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> [[TMP0]], i32 [[SUB14]], i32 1
18 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 1, i32 1>
19 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt <4 x i32> [[SHUFFLE]], <i32 0, i32 -1, i32 -5, i32 -9>
20 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> undef, i32 [[SHR15]], i32 0
21 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <4 x i32> [[TMP3]], i32 undef, i32 1
22 ; CHECK-NEXT: [[TMP5:%.*]] = insertelement <4 x i32> [[TMP4]], i32 undef, i32 2
23 ; CHECK-NEXT: [[TMP6:%.*]] = insertelement <4 x i32> [[TMP5]], i32 undef, i32 3
24 ; CHECK-NEXT: [[TMP7:%.*]] = select <4 x i1> [[TMP2]], <4 x i32> [[TMP6]], <4 x i32> zeroinitializer
25 ; CHECK-NEXT: [[TMP8:%.*]] = icmp slt <4 x i32> [[TMP7]], undef
26 ; CHECK-NEXT: [[TMP9:%.*]] = select <4 x i1> [[TMP8]], <4 x i32> [[TMP7]], <4 x i32> undef
27 ; CHECK-NEXT: [[TMP10:%.*]] = sext <4 x i32> [[TMP9]] to <4 x i64>
28 ; CHECK-NEXT: [[TMP11:%.*]] = trunc <4 x i64> [[TMP10]] to <4 x i32>
29 ; CHECK-NEXT: [[TMP12:%.*]] = extractelement <4 x i32> [[TMP11]], i32 0
30 ; CHECK-NEXT: [[TMP13:%.*]] = sext i32 [[TMP12]] to i64
31 ; CHECK-NEXT: [[ARRAYIDX31:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP13]]
32 ; CHECK-NEXT: [[TMP14:%.*]] = extractelement <4 x i32> [[TMP11]], i32 1
33 ; CHECK-NEXT: [[TMP15:%.*]] = sext i32 [[TMP14]] to i64
34 ; CHECK-NEXT: [[ARRAYIDX31_1:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP15]]
35 ; CHECK-NEXT: [[TMP16:%.*]] = extractelement <4 x i32> [[TMP11]], i32 2
36 ; CHECK-NEXT: [[TMP17:%.*]] = sext i32 [[TMP16]] to i64
37 ; CHECK-NEXT: [[ARRAYIDX31_2:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP17]]
38 ; CHECK-NEXT: [[TMP18:%.*]] = extractelement <4 x i32> [[TMP11]], i32 3
39 ; CHECK-NEXT: [[TMP19:%.*]] = sext i32 [[TMP18]] to i64
40 ; CHECK-NEXT: [[ARRAYIDX31_3:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP19]]
41 ; CHECK-NEXT: unreachable
44 br label %land.lhs.true
46 land.lhs.true: ; preds = %entry
47 br i1 undef, label %if.then, label %if.end
49 if.then: ; preds = %land.lhs.true
52 if.end: ; preds = %land.lhs.true
53 %sub14 = sub nsw i32 %y_pos, undef
54 %shr15 = ashr i32 %sub14, 2
55 %cmp.i.i = icmp sgt i32 %shr15, 0
56 %cond.i.i = select i1 %cmp.i.i, i32 %shr15, i32 0
57 %cmp.i4.i = icmp slt i32 %cond.i.i, undef
58 %cond.i5.i = select i1 %cmp.i4.i, i32 %cond.i.i, i32 undef
59 %idxprom30 = sext i32 %cond.i5.i to i64
60 %arrayidx31 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30
61 %cmp.i.i.1 = icmp sgt i32 %sub14, -1
62 %cond.i.i.1 = select i1 %cmp.i.i.1, i32 undef, i32 0
63 %cmp.i4.i.1 = icmp slt i32 %cond.i.i.1, undef
64 %cond.i5.i.1 = select i1 %cmp.i4.i.1, i32 %cond.i.i.1, i32 undef
65 %idxprom30.1 = sext i32 %cond.i5.i.1 to i64
66 %arrayidx31.1 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.1
67 %cmp.i.i.2 = icmp sgt i32 %sub14, -5
68 %cond.i.i.2 = select i1 %cmp.i.i.2, i32 undef, i32 0
69 %cmp.i4.i.2 = icmp slt i32 %cond.i.i.2, undef
70 %cond.i5.i.2 = select i1 %cmp.i4.i.2, i32 %cond.i.i.2, i32 undef
71 %idxprom30.2 = sext i32 %cond.i5.i.2 to i64
72 %arrayidx31.2 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.2
73 %cmp.i.i.3 = icmp sgt i32 %sub14, -9
74 %cond.i.i.3 = select i1 %cmp.i.i.3, i32 undef, i32 0
75 %cmp.i4.i.3 = icmp slt i32 %cond.i.i.3, undef
76 %cond.i5.i.3 = select i1 %cmp.i4.i.3, i32 %cond.i.i.3, i32 undef
77 %idxprom30.3 = sext i32 %cond.i5.i.3 to i64
78 %arrayidx31.3 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.3