1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 < %s | FileCheck %s
4 define <4 x half> @phis(i1 %cmp1, <4 x half> %in1, <4 x half> %in2) {
7 ; CHECK-NEXT: [[A2:%.*]] = extractelement <4 x half> [[IN1:%.*]], i64 2
8 ; CHECK-NEXT: [[A3:%.*]] = extractelement <4 x half> [[IN1]], i64 3
9 ; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
10 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]]
12 ; CHECK-NEXT: [[B2:%.*]] = extractelement <4 x half> [[IN2:%.*]], i64 2
13 ; CHECK-NEXT: [[B3:%.*]] = extractelement <4 x half> [[IN2]], i64 3
14 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
15 ; CHECK-NEXT: br label [[BB1]]
17 ; CHECK-NEXT: [[C2:%.*]] = phi half [ [[A2]], [[ENTRY:%.*]] ], [ [[B2]], [[BB0]] ]
18 ; CHECK-NEXT: [[C3:%.*]] = phi half [ [[A3]], [[ENTRY]] ], [ [[B3]], [[BB0]] ]
19 ; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY]] ], [ [[TMP1]], [[BB0]] ]
20 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x half> [[TMP2]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
21 ; CHECK-NEXT: [[O2:%.*]] = insertelement <4 x half> [[TMP3]], half [[C2]], i64 2
22 ; CHECK-NEXT: [[O3:%.*]] = insertelement <4 x half> [[O2]], half [[C3]], i64 3
23 ; CHECK-NEXT: ret <4 x half> [[O3]]
26 %a0 = extractelement <4 x half> %in1, i64 0
27 %a1 = extractelement <4 x half> %in1, i64 1
28 %a2 = extractelement <4 x half> %in1, i64 2
29 %a3 = extractelement <4 x half> %in1, i64 3
30 br i1 %cmp1, label %bb1, label %bb0
33 %b0 = extractelement <4 x half> %in2, i64 0
34 %b1 = extractelement <4 x half> %in2, i64 1
35 %b2 = extractelement <4 x half> %in2, i64 2
36 %b3 = extractelement <4 x half> %in2, i64 3
40 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ]
41 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ]
42 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ]
43 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ]
45 %o0 = insertelement <4 x half> undef, half %c0, i64 0
46 %o1 = insertelement <4 x half> %o0, half %c1, i64 1
47 %o2 = insertelement <4 x half> %o1, half %c2, i64 2
48 %o3 = insertelement <4 x half> %o2, half %c3, i64 3
52 define <4 x half> @phis_reverse(i1 %cmp1, <4 x half> %in1, <4 x half> %in2) {
53 ; CHECK-LABEL: @phis_reverse(
55 ; CHECK-NEXT: [[A2:%.*]] = extractelement <4 x half> [[IN1:%.*]], i64 2
56 ; CHECK-NEXT: [[A3:%.*]] = extractelement <4 x half> [[IN1]], i64 3
57 ; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
58 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]]
60 ; CHECK-NEXT: [[B2:%.*]] = extractelement <4 x half> [[IN2:%.*]], i64 2
61 ; CHECK-NEXT: [[B3:%.*]] = extractelement <4 x half> [[IN2]], i64 3
62 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
63 ; CHECK-NEXT: br label [[BB1]]
65 ; CHECK-NEXT: [[C3:%.*]] = phi half [ [[A3]], [[ENTRY:%.*]] ], [ [[B3]], [[BB0]] ]
66 ; CHECK-NEXT: [[C2:%.*]] = phi half [ [[A2]], [[ENTRY]] ], [ [[B2]], [[BB0]] ]
67 ; CHECK-NEXT: [[TMP2:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY]] ], [ [[TMP1]], [[BB0]] ]
68 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <2 x half> [[TMP2]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
69 ; CHECK-NEXT: [[O2:%.*]] = insertelement <4 x half> [[TMP3]], half [[C2]], i64 2
70 ; CHECK-NEXT: [[O3:%.*]] = insertelement <4 x half> [[O2]], half [[C3]], i64 3
71 ; CHECK-NEXT: ret <4 x half> [[O3]]
74 %a0 = extractelement <4 x half> %in1, i64 0
75 %a1 = extractelement <4 x half> %in1, i64 1
76 %a2 = extractelement <4 x half> %in1, i64 2
77 %a3 = extractelement <4 x half> %in1, i64 3
78 br i1 %cmp1, label %bb1, label %bb0
81 %b0 = extractelement <4 x half> %in2, i64 0
82 %b1 = extractelement <4 x half> %in2, i64 1
83 %b2 = extractelement <4 x half> %in2, i64 2
84 %b3 = extractelement <4 x half> %in2, i64 3
88 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ]
89 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ]
90 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ]
91 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ]
93 %o0 = insertelement <4 x half> undef, half %c0, i64 0
94 %o1 = insertelement <4 x half> %o0, half %c1, i64 1
95 %o2 = insertelement <4 x half> %o1, half %c2, i64 2
96 %o3 = insertelement <4 x half> %o2, half %c3, i64 3