1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S -o - -mtriple=x86_64-unknown-linux-gnu -mcpu=haswell < %s | FileCheck %s
4 define void @wombat(ptr %ptr, ptr %ptr1) {
5 ; CHECK-LABEL: @wombat(
7 ; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i32, ptr [[PTR1:%.*]], i32 3
8 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[PTR:%.*]], align 8
9 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i32> [[TMP0]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
10 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <2 x i32> <i32 0, i32 1>
11 ; CHECK-NEXT: [[TMP3:%.*]] = add nsw <2 x i32> [[TMP2]], <i32 -1, i32 -1>
12 ; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <2 x i32> [[TMP3]], <2 x i32> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
13 ; CHECK-NEXT: [[TMP5:%.*]] = icmp sgt <4 x i32> [[TMP1]], undef
14 ; CHECK-NEXT: [[TMP6:%.*]] = select <4 x i1> [[TMP5]], <4 x i32> undef, <4 x i32> [[TMP4]]
15 ; CHECK-NEXT: [[TMP7:%.*]] = select <4 x i1> zeroinitializer, <4 x i32> zeroinitializer, <4 x i32> [[TMP6]]
16 ; CHECK-NEXT: store <4 x i32> [[TMP7]], ptr [[TMP27]], align 8
17 ; CHECK-NEXT: ret void
20 %tmp7 = getelementptr inbounds i32, ptr %ptr, i64 1
21 %tmp12 = load i32, ptr %tmp7, align 4
22 %tmp13 = load i32, ptr %ptr, align 8
23 %tmp21 = add nsw i32 %tmp12, -1
24 %tmp22 = fptosi float undef to i32
25 %tmp23 = icmp slt i32 %tmp22, 0
26 %tmp24 = icmp sgt i32 %tmp12, %tmp22
27 %tmp25 = select i1 %tmp24, i32 %tmp22, i32 %tmp21
28 %tmp26 = select i1 %tmp23, i32 0, i32 %tmp25
29 %tmp27 = getelementptr inbounds i32, ptr %ptr1, i32 3
30 store i32 %tmp26, ptr %tmp27, align 8
31 %tmp28 = add nsw i32 %tmp13, -1
32 %tmp29 = fptosi float undef to i32
33 %tmp30 = icmp slt i32 %tmp29, 0
34 %tmp31 = icmp sgt i32 %tmp13, %tmp29
35 %tmp32 = select i1 %tmp31, i32 %tmp29, i32 %tmp28
36 %tmp33 = select i1 %tmp30, i32 0, i32 %tmp32
37 %tmp34 = getelementptr inbounds i32, ptr %ptr1, i32 4
38 store i32 %tmp33, ptr %tmp34, align 4
39 %tmp35 = fptosi float undef to i32
40 %tmp36 = icmp slt i32 %tmp35, 0
41 %tmp37 = icmp sgt i32 %tmp12, %tmp35
42 %tmp38 = select i1 %tmp37, i32 %tmp35, i32 %tmp21
43 %tmp39 = select i1 %tmp36, i32 0, i32 %tmp38
44 %tmp40 = getelementptr inbounds i32, ptr %ptr1, i32 5
45 store i32 %tmp39, ptr %tmp40, align 8
46 %tmp41 = fptosi float undef to i32
47 %tmp42 = icmp slt i32 %tmp41, 0
48 %tmp43 = icmp sgt i32 %tmp13, %tmp41
49 %tmp44 = select i1 %tmp43, i32 %tmp41, i32 %tmp28
50 %tmp45 = select i1 %tmp42, i32 0, i32 %tmp44
51 %tmp46 = getelementptr inbounds i32, ptr %ptr1, i32 6
52 store i32 %tmp45, ptr %tmp46, align 4
56 define internal i32 @ipvideo_decode_block_opcode_0xD_16() {
57 ; CHECK-LABEL: @ipvideo_decode_block_opcode_0xD_16(
59 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
61 ; CHECK-NEXT: [[TMP0:%.*]] = phi <2 x i16> [ undef, [[ENTRY:%.*]] ], [ [[TMP0]], [[IF_END:%.*]] ]
62 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i16> [[TMP0]], <2 x i16> poison, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
63 ; CHECK-NEXT: br label [[IF_END]]
65 ; CHECK-NEXT: store <8 x i16> [[TMP1]], ptr undef, align 2
66 ; CHECK-NEXT: br label [[FOR_BODY]]
71 for.body: ; preds = %if.end, %entry
72 %P.sroa.7.0 = phi i16 [ undef, %entry ], [ %P.sroa.7.0, %if.end ]
73 %P.sroa.0.0 = phi i16 [ undef, %entry ], [ %P.sroa.0.0, %if.end ]
76 if.end: ; preds = %for.body
77 store i16 %P.sroa.0.0, ptr undef, align 2
78 %arrayidx11.1 = getelementptr inbounds i16, ptr undef, i32 1
79 store i16 %P.sroa.0.0, ptr %arrayidx11.1, align 2
80 %arrayidx11.2 = getelementptr inbounds i16, ptr undef, i32 2
81 store i16 %P.sroa.0.0, ptr %arrayidx11.2, align 2
82 %arrayidx11.3 = getelementptr inbounds i16, ptr undef, i32 3
83 store i16 %P.sroa.0.0, ptr %arrayidx11.3, align 2
84 %arrayidx11.4 = getelementptr inbounds i16, ptr undef, i32 4
85 store i16 %P.sroa.7.0, ptr %arrayidx11.4, align 2
86 %arrayidx11.5 = getelementptr inbounds i16, ptr undef, i32 5
87 store i16 %P.sroa.7.0, ptr %arrayidx11.5, align 2
88 %arrayidx11.6 = getelementptr inbounds i16, ptr undef, i32 6
89 store i16 %P.sroa.7.0, ptr %arrayidx11.6, align 2
90 %arrayidx11.7 = getelementptr inbounds i16, ptr undef, i32 7
91 store i16 %P.sroa.7.0, ptr %arrayidx11.7, align 2