193a9be0cSAlexey Bataev; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2e98501e2Sskc7; RUN: opt -passes=slp-vectorizer -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 < %s | FileCheck %s 3e98501e2Sskc7 4e98501e2Sskc7define <4 x half> @phis(i1 %cmp1, <4 x half> %in1, <4 x half> %in2) { 5e98501e2Sskc7; CHECK-LABEL: @phis( 6e98501e2Sskc7; CHECK-NEXT: entry: 7*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1:%.*]], <4 x half> poison, <2 x i32> <i32 0, i32 1> 8*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 2, i32 3> 993a9be0cSAlexey Bataev; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]] 10e98501e2Sskc7; CHECK: bb0: 11*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x half> [[IN2:%.*]], <4 x half> poison, <2 x i32> <i32 0, i32 1> 12*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 2, i32 3> 1393a9be0cSAlexey Bataev; CHECK-NEXT: br label [[BB1]] 14e98501e2Sskc7; CHECK: bb1: 15*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP4:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP2]], [[BB0]] ] 16*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x half> [ [[TMP1]], [[ENTRY]] ], [ [[TMP3]], [[BB0]] ] 17*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison> 18*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x half> [[TMP5]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison> 19*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> [[TMP5]], <4 x i32> <i32 0, i32 1, i32 2, i32 3> 20*ea43a308SJeffrey Byrnes; CHECK-NEXT: ret <4 x half> [[TMP8]] 2193a9be0cSAlexey Bataev; 22e98501e2Sskc7entry: 23e98501e2Sskc7 %a0 = extractelement <4 x half> %in1, i64 0 24e98501e2Sskc7 %a1 = extractelement <4 x half> %in1, i64 1 25e98501e2Sskc7 %a2 = extractelement <4 x half> %in1, i64 2 26e98501e2Sskc7 %a3 = extractelement <4 x half> %in1, i64 3 27e98501e2Sskc7 br i1 %cmp1, label %bb1, label %bb0 28e98501e2Sskc7 29e98501e2Sskc7bb0: 30e98501e2Sskc7 %b0 = extractelement <4 x half> %in2, i64 0 31e98501e2Sskc7 %b1 = extractelement <4 x half> %in2, i64 1 32e98501e2Sskc7 %b2 = extractelement <4 x half> %in2, i64 2 33e98501e2Sskc7 %b3 = extractelement <4 x half> %in2, i64 3 34e98501e2Sskc7 br label %bb1 35e98501e2Sskc7 36e98501e2Sskc7bb1: 37e98501e2Sskc7 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ] 38e98501e2Sskc7 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ] 39e98501e2Sskc7 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ] 40e98501e2Sskc7 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ] 41e98501e2Sskc7 42e98501e2Sskc7 %o0 = insertelement <4 x half> undef, half %c0, i64 0 43e98501e2Sskc7 %o1 = insertelement <4 x half> %o0, half %c1, i64 1 44e98501e2Sskc7 %o2 = insertelement <4 x half> %o1, half %c2, i64 2 45e98501e2Sskc7 %o3 = insertelement <4 x half> %o2, half %c3, i64 3 46e98501e2Sskc7 ret <4 x half> %o3 47e98501e2Sskc7} 48e98501e2Sskc7 49e98501e2Sskc7define <4 x half> @phis_reverse(i1 %cmp1, <4 x half> %in1, <4 x half> %in2) { 50e98501e2Sskc7; CHECK-LABEL: @phis_reverse( 51e98501e2Sskc7; CHECK-NEXT: entry: 52*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <4 x half> [[IN1:%.*]], <4 x half> poison, <2 x i32> <i32 2, i32 3> 53*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x half> [[IN1]], <4 x half> poison, <2 x i32> <i32 0, i32 1> 5493a9be0cSAlexey Bataev; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[BB0:%.*]] 55e98501e2Sskc7; CHECK: bb0: 56*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x half> [[IN2:%.*]], <4 x half> poison, <2 x i32> <i32 2, i32 3> 57*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x half> [[IN2]], <4 x half> poison, <2 x i32> <i32 0, i32 1> 5893a9be0cSAlexey Bataev; CHECK-NEXT: br label [[BB1]] 59e98501e2Sskc7; CHECK: bb1: 60*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP4:%.*]] = phi <2 x half> [ [[TMP0]], [[ENTRY:%.*]] ], [ [[TMP2]], [[BB0]] ] 61*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP5:%.*]] = phi <2 x half> [ [[TMP1]], [[ENTRY]] ], [ [[TMP3]], [[BB0]] ] 62*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <2 x half> [[TMP5]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison> 63*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x half> [[TMP4]], <2 x half> poison, <4 x i32> <i32 0, i32 1, i32 poison, i32 poison> 64*ea43a308SJeffrey Byrnes; CHECK-NEXT: [[TMP8:%.*]] = shufflevector <4 x half> [[TMP6]], <4 x half> [[TMP7]], <4 x i32> <i32 0, i32 1, i32 4, i32 5> 65*ea43a308SJeffrey Byrnes; CHECK-NEXT: ret <4 x half> [[TMP8]] 6693a9be0cSAlexey Bataev; 67e98501e2Sskc7entry: 68e98501e2Sskc7 %a0 = extractelement <4 x half> %in1, i64 0 69e98501e2Sskc7 %a1 = extractelement <4 x half> %in1, i64 1 70e98501e2Sskc7 %a2 = extractelement <4 x half> %in1, i64 2 71e98501e2Sskc7 %a3 = extractelement <4 x half> %in1, i64 3 72e98501e2Sskc7 br i1 %cmp1, label %bb1, label %bb0 73e98501e2Sskc7 74e98501e2Sskc7bb0: 75e98501e2Sskc7 %b0 = extractelement <4 x half> %in2, i64 0 76e98501e2Sskc7 %b1 = extractelement <4 x half> %in2, i64 1 77e98501e2Sskc7 %b2 = extractelement <4 x half> %in2, i64 2 78e98501e2Sskc7 %b3 = extractelement <4 x half> %in2, i64 3 79e98501e2Sskc7 br label %bb1 80e98501e2Sskc7 81e98501e2Sskc7bb1: 82e98501e2Sskc7 %c3 = phi half [ %a3, %entry ], [ %b3, %bb0 ] 83e98501e2Sskc7 %c2 = phi half [ %a2, %entry ], [ %b2, %bb0 ] 84e98501e2Sskc7 %c1 = phi half [ %a1, %entry ], [ %b1, %bb0 ] 85e98501e2Sskc7 %c0 = phi half [ %a0, %entry ], [ %b0, %bb0 ] 86e98501e2Sskc7 87e98501e2Sskc7 %o0 = insertelement <4 x half> undef, half %c0, i64 0 88e98501e2Sskc7 %o1 = insertelement <4 x half> %o0, half %c1, i64 1 89e98501e2Sskc7 %o2 = insertelement <4 x half> %o1, half %c2, i64 2 90e98501e2Sskc7 %o3 = insertelement <4 x half> %o2, half %c3, i64 3 91e98501e2Sskc7 ret <4 x half> %o3 92e98501e2Sskc7} 93