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: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1:%.*]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
8 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 2, i32 3>
9 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]]
11 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x half> [[IN2:%.*]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
12 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 2, i32 3>
13 ; CHECK-NEXT: br label [[BB1]]
15 ; CHECK-NEXT: [[TMP4:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP2]], [[BB0]] ]
16 ; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x half> [ [[TMP1]], [[ENTRY]] ], [ [[TMP3]], [[BB0]] ]
17 ; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
18 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x half> [[TMP5]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
19 ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3>
20 ; CHECK-NEXT: ret <4 x half> [[TMP8]]
23 %a0 = extractelement <4 x half> %in1, i64 0
24 %a1 = extractelement <4 x half> %in1, i64 1
25 %a2 = extractelement <4 x half> %in1, i64 2
26 %a3 = extractelement <4 x half> %in1, i64 3
27 br i1 %cmp1, label %bb1, label %bb0
30 %b0 = extractelement <4 x half> %in2, i64 0
31 %b1 = extractelement <4 x half> %in2, i64 1
32 %b2 = extractelement <4 x half> %in2, i64 2
33 %b3 = extractelement <4 x half> %in2, i64 3
37 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ]
38 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ]
39 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ]
40 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ]
42 %o0 = insertelement <4 x half> undef, half %c0, i64 0
43 %o1 = insertelement <4 x half> %o0, half %c1, i64 1
44 %o2 = insertelement <4 x half> %o1, half %c2, i64 2
45 %o3 = insertelement <4 x half> %o2, half %c3, i64 3
49 define <4 x half> @phis_reverse(i1 %cmp1, <4 x half> %in1, <4 x half> %in2) {
50 ; CHECK-LABEL: @phis_reverse(
52 ; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1:%.*]], <4 x half> poison, <2 x i32> <i32 2, i32 3>
53 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
54 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]]
56 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x half> [[IN2:%.*]], <4 x half> poison, <2 x i32> <i32 2, i32 3>
57 ; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 0, i32 1>
58 ; CHECK-NEXT: br label [[BB1]]
60 ; CHECK-NEXT: [[TMP4:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP2]], [[BB0]] ]
61 ; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x half> [ [[TMP1]], [[ENTRY]] ], [ [[TMP3]], [[BB0]] ]
62 ; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x half> [[TMP5]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
63 ; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison>
64 ; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <4 x half> [[TMP6]], <4 x half> [[TMP7]], <4 x i32> <i32 0, i32 1, i32 4, i32 5>
65 ; CHECK-NEXT: ret <4 x half> [[TMP8]]
68 %a0 = extractelement <4 x half> %in1, i64 0
69 %a1 = extractelement <4 x half> %in1, i64 1
70 %a2 = extractelement <4 x half> %in1, i64 2
71 %a3 = extractelement <4 x half> %in1, i64 3
72 br i1 %cmp1, label %bb1, label %bb0
75 %b0 = extractelement <4 x half> %in2, i64 0
76 %b1 = extractelement <4 x half> %in2, i64 1
77 %b2 = extractelement <4 x half> %in2, i64 2
78 %b3 = extractelement <4 x half> %in2, i64 3
82 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ]
83 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ]
84 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ]
85 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ]
87 %o0 = insertelement <4 x half> undef, half %c0, i64 0
88 %o1 = insertelement <4 x half> %o0, half %c1, i64 1
89 %o2 = insertelement <4 x half> %o1, half %c2, i64 2
90 %o3 = insertelement <4 x half> %o2, half %c3, i64 3