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
3
4; Function Attrs: nounwind uwtable
5define void @get_block(i32 %y_pos) local_unnamed_addr #0 {
6; CHECK-LABEL: @get_block(
7; CHECK-NEXT:  entry:
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:%.*]]
11; CHECK:       if.then:
12; CHECK-NEXT:    unreachable
13; CHECK:       if.end:
14; CHECK-NEXT:    [[SUB14:%.*]] = sub nsw i32 [[Y_POS:%.*]], undef
15; CHECK-NEXT:    [[SHR15:%.*]] = ashr i32 [[SUB14]], 2
16; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <4 x i32> poison, i32 [[SHR15]], i32 0
17; CHECK-NEXT:    [[TMP1:%.*]] = insertelement <4 x i32> [[TMP0]], i32 [[SUB14]], i32 1
18; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <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:%.*]] = select <4 x i1> [[TMP2]], <4 x i32> [[TMP0]], <4 x i32> zeroinitializer
21; CHECK-NEXT:    [[TMP4:%.*]] = icmp slt <4 x i32> [[TMP3]], undef
22; CHECK-NEXT:    [[TMP5:%.*]] = select <4 x i1> [[TMP4]], <4 x i32> [[TMP3]], <4 x i32> undef
23; CHECK-NEXT:    [[TMP6:%.*]] = sext <4 x i32> [[TMP5]] to <4 x i64>
24; CHECK-NEXT:    [[TMP7:%.*]] = trunc <4 x i64> [[TMP6]] to <4 x i32>
25; CHECK-NEXT:    [[TMP8:%.*]] = extractelement <4 x i32> [[TMP7]], i32 0
26; CHECK-NEXT:    [[TMP9:%.*]] = sext i32 [[TMP8]] to i64
27; CHECK-NEXT:    [[ARRAYIDX31:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP9]]
28; CHECK-NEXT:    [[TMP10:%.*]] = extractelement <4 x i32> [[TMP7]], i32 1
29; CHECK-NEXT:    [[TMP11:%.*]] = sext i32 [[TMP10]] to i64
30; CHECK-NEXT:    [[ARRAYIDX31_1:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP11]]
31; CHECK-NEXT:    [[TMP12:%.*]] = extractelement <4 x i32> [[TMP7]], i32 2
32; CHECK-NEXT:    [[TMP13:%.*]] = sext i32 [[TMP12]] to i64
33; CHECK-NEXT:    [[ARRAYIDX31_2:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP13]]
34; CHECK-NEXT:    [[TMP14:%.*]] = extractelement <4 x i32> [[TMP7]], i32 3
35; CHECK-NEXT:    [[TMP15:%.*]] = sext i32 [[TMP14]] to i64
36; CHECK-NEXT:    [[ARRAYIDX31_3:%.*]] = getelementptr inbounds i16*, i16** undef, i64 [[TMP15]]
37; CHECK-NEXT:    unreachable
38;
39entry:
40  br label %land.lhs.true
41
42land.lhs.true:                                    ; preds = %entry
43  br i1 undef, label %if.then, label %if.end
44
45if.then:                                          ; preds = %land.lhs.true
46  unreachable
47
48if.end:                                           ; preds = %land.lhs.true
49  %sub14 = sub nsw i32 %y_pos, undef
50  %shr15 = ashr i32 %sub14, 2
51  %cmp.i.i = icmp sgt i32 %shr15, 0
52  %cond.i.i = select i1 %cmp.i.i, i32 %shr15, i32 0
53  %cmp.i4.i = icmp slt i32 %cond.i.i, undef
54  %cond.i5.i = select i1 %cmp.i4.i, i32 %cond.i.i, i32 undef
55  %idxprom30 = sext i32 %cond.i5.i to i64
56  %arrayidx31 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30
57  %cmp.i.i.1 = icmp sgt i32 %sub14, -1
58  %cond.i.i.1 = select i1 %cmp.i.i.1, i32 undef, i32 0
59  %cmp.i4.i.1 = icmp slt i32 %cond.i.i.1, undef
60  %cond.i5.i.1 = select i1 %cmp.i4.i.1, i32 %cond.i.i.1, i32 undef
61  %idxprom30.1 = sext i32 %cond.i5.i.1 to i64
62  %arrayidx31.1 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.1
63  %cmp.i.i.2 = icmp sgt i32 %sub14, -5
64  %cond.i.i.2 = select i1 %cmp.i.i.2, i32 undef, i32 0
65  %cmp.i4.i.2 = icmp slt i32 %cond.i.i.2, undef
66  %cond.i5.i.2 = select i1 %cmp.i4.i.2, i32 %cond.i.i.2, i32 undef
67  %idxprom30.2 = sext i32 %cond.i5.i.2 to i64
68  %arrayidx31.2 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.2
69  %cmp.i.i.3 = icmp sgt i32 %sub14, -9
70  %cond.i.i.3 = select i1 %cmp.i.i.3, i32 undef, i32 0
71  %cmp.i4.i.3 = icmp slt i32 %cond.i.i.3, undef
72  %cond.i5.i.3 = select i1 %cmp.i4.i.3, i32 %cond.i.i.3, i32 undef
73  %idxprom30.3 = sext i32 %cond.i5.i.3 to i64
74  %arrayidx31.3 = getelementptr inbounds i16*, i16** undef, i64 %idxprom30.3
75  unreachable
76}
77