165 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=slp-vectorizer -S -o - -mtriple=x86_64-unknown-linux -mcpu=bdver2 | FileCheck %s3 4define <2 x i8> @g(<2 x i8> %x, <2 x i8> %y) {5; CHECK-LABEL: @g(6; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]], <2 x i32> <i32 0, i32 3>7; CHECK-NEXT: [[TMP2:%.*]] = mul <2 x i8> [[TMP1]], [[TMP1]]8; CHECK-NEXT: ret <2 x i8> [[TMP2]]9;10 %x0 = extractelement <2 x i8> %x, i32 011 %y1 = extractelement <2 x i8> %y, i32 112 %x0x0 = mul i8 %x0, %x013 %y1y1 = mul i8 %y1, %y114 %ins1 = insertelement <2 x i8> poison, i8 %x0x0, i32 015 %ins2 = insertelement <2 x i8> %ins1, i8 %y1y1, i32 116 ret <2 x i8> %ins217}18 19define <4 x i8> @h(<4 x i8> %x, <4 x i8> %y) {20; CHECK-LABEL: @h(21; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <4 x i32> <i32 0, i32 3, i32 5, i32 6>22; CHECK-NEXT: [[TMP2:%.*]] = mul <4 x i8> [[TMP1]], [[TMP1]]23; CHECK-NEXT: ret <4 x i8> [[TMP2]]24;25 %x0 = extractelement <4 x i8> %x, i32 026 %x3 = extractelement <4 x i8> %x, i32 327 %y1 = extractelement <4 x i8> %y, i32 128 %y2 = extractelement <4 x i8> %y, i32 229 %x0x0 = mul i8 %x0, %x030 %x3x3 = mul i8 %x3, %x331 %y1y1 = mul i8 %y1, %y132 %y2y2 = mul i8 %y2, %y233 %ins1 = insertelement <4 x i8> poison, i8 %x0x0, i32 034 %ins2 = insertelement <4 x i8> %ins1, i8 %x3x3, i32 135 %ins3 = insertelement <4 x i8> %ins2, i8 %y1y1, i32 236 %ins4 = insertelement <4 x i8> %ins3, i8 %y2y2, i32 337 ret <4 x i8> %ins438}39 40define <4 x i8> @h_undef(<4 x i8> %x, <4 x i8> %y) {41; CHECK-LABEL: @h_undef(42; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <4 x i32> <i32 poison, i32 3, i32 5, i32 6>43; CHECK-NEXT: [[TMP2:%.*]] = mul <4 x i8> [[TMP1]], [[TMP1]]44; CHECK-NEXT: ret <4 x i8> [[TMP2]]45;46 %x0 = extractelement <4 x i8> poison, i32 047 %x3 = extractelement <4 x i8> %x, i32 348 %y1 = extractelement <4 x i8> %y, i32 149 %y2 = extractelement <4 x i8> %y, i32 250 %x0x0 = mul i8 %x0, %x051 %x3x3 = mul i8 %x3, %x352 %y1y1 = mul i8 %y1, %y153 %y2y2 = mul i8 %y2, %y254 %ins1 = insertelement <4 x i8> poison, i8 %x0x0, i32 055 %ins2 = insertelement <4 x i8> %ins1, i8 %x3x3, i32 156 %ins3 = insertelement <4 x i8> %ins2, i8 %y1y1, i32 257 %ins4 = insertelement <4 x i8> %ins3, i8 %y2y2, i32 358 ret <4 x i8> %ins459}60 61define i8 @i(<4 x i8> %x, <4 x i8> %y) {62; CHECK-LABEL: @i(63; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <4 x i32> <i32 0, i32 3, i32 5, i32 6>64; CHECK-NEXT: [[TMP2:%.*]] = mul <4 x i8> [[TMP1]], [[TMP1]]65; CHECK-NEXT: [[TMP3:%.*]] = call i8 @llvm.vector.reduce.add.v4i8(<4 x i8> [[TMP2]])66; CHECK-NEXT: ret i8 [[TMP3]]67;68 %x0 = extractelement <4 x i8> %x, i32 069 %x3 = extractelement <4 x i8> %x, i32 370 %y1 = extractelement <4 x i8> %y, i32 171 %y2 = extractelement <4 x i8> %y, i32 272 %x0x0 = mul i8 %x0, %x073 %x3x3 = mul i8 %x3, %x374 %y1y1 = mul i8 %y1, %y175 %y2y2 = mul i8 %y2, %y276 %1 = add i8 %x0x0, %x3x377 %2 = add i8 %y1y1, %y2y278 %3 = add i8 %1, %279 ret i8 %380}81 82define i8 @j(<4 x i8> %x, <4 x i8> %y) {83; CHECK-LABEL: @j(84; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]], <2 x i32> <i32 0, i32 5>85; CHECK-NEXT: [[TMP2:%.*]] = mul <2 x i8> [[TMP1]], [[TMP1]]86; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i8> [[X]], <4 x i8> [[Y]], <2 x i32> <i32 3, i32 6>87; CHECK-NEXT: [[TMP4:%.*]] = mul <2 x i8> [[TMP3]], [[TMP3]]88; CHECK-NEXT: [[TMP5:%.*]] = add <2 x i8> [[TMP2]], [[TMP4]]89; CHECK-NEXT: [[TMP6:%.*]] = extractelement <2 x i8> [[TMP5]], i32 090; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i8> [[TMP5]], i32 191; CHECK-NEXT: [[TMP8:%.*]] = sdiv i8 [[TMP6]], [[TMP7]]92; CHECK-NEXT: ret i8 [[TMP8]]93;94 %x0 = extractelement <4 x i8> %x, i32 095 %x3 = extractelement <4 x i8> %x, i32 396 %y1 = extractelement <4 x i8> %y, i32 197 %y2 = extractelement <4 x i8> %y, i32 298 %x0x0 = mul i8 %x0, %x099 %x3x3 = mul i8 %x3, %x3100 %y1y1 = mul i8 %y1, %y1101 %y2y2 = mul i8 %y2, %y2102 %1 = add i8 %x0x0, %x3x3103 %2 = add i8 %y1y1, %y2y2104 %3 = sdiv i8 %1, %2105 ret i8 %3106}107 108define i8 @k(<4 x i8> %x) {109; CHECK-LABEL: @k(110; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i8> [[TMP1:%.*]], <4 x i8> poison, <2 x i32> <i32 0, i32 1>111; CHECK-NEXT: [[TMP10:%.*]] = mul <2 x i8> [[TMP2]], [[TMP2]]112; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i8> [[TMP1]], <4 x i8> poison, <2 x i32> <i32 2, i32 3>113; CHECK-NEXT: [[TMP4:%.*]] = mul <2 x i8> [[TMP3]], [[TMP3]]114; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <2 x i8> [[TMP4]], <2 x i8> poison, <2 x i32> <i32 1, i32 0>115; CHECK-NEXT: [[TMP6:%.*]] = add <2 x i8> [[TMP10]], [[TMP5]]116; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i8> [[TMP6]], i32 0117; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i8> [[TMP6]], i32 1118; CHECK-NEXT: [[TMP9:%.*]] = sdiv i8 [[TMP7]], [[TMP8]]119; CHECK-NEXT: ret i8 [[TMP9]]120;121 %x0 = extractelement <4 x i8> %x, i32 0122 %x3 = extractelement <4 x i8> %x, i32 3123 %x1 = extractelement <4 x i8> %x, i32 1124 %x2 = extractelement <4 x i8> %x, i32 2125 %x0x0 = mul i8 %x0, %x0126 %x3x3 = mul i8 %x3, %x3127 %x1x1 = mul i8 %x1, %x1128 %x2x2 = mul i8 %x2, %x2129 %1 = add i8 %x0x0, %x3x3130 %2 = add i8 %x1x1, %x2x2131 %3 = sdiv i8 %1, %2132 ret i8 %3133}134 135define i8 @k_bb(<4 x i8> %x) {136; CHECK-LABEL: @k_bb(137; CHECK-NEXT: br label [[BB1:%.*]]138; CHECK: bb1:139; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i8> [[TMP1:%.*]], <4 x i8> poison, <2 x i32> <i32 0, i32 1>140; CHECK-NEXT: [[TMP10:%.*]] = mul <2 x i8> [[TMP2]], [[TMP2]]141; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <4 x i8> [[TMP1]], <4 x i8> poison, <2 x i32> <i32 2, i32 3>142; CHECK-NEXT: [[TMP4:%.*]] = mul <2 x i8> [[TMP3]], [[TMP3]]143; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <2 x i8> [[TMP4]], <2 x i8> poison, <2 x i32> <i32 1, i32 0>144; CHECK-NEXT: [[TMP6:%.*]] = add <2 x i8> [[TMP10]], [[TMP5]]145; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x i8> [[TMP6]], i32 0146; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i8> [[TMP6]], i32 1147; CHECK-NEXT: [[TMP9:%.*]] = sdiv i8 [[TMP7]], [[TMP8]]148; CHECK-NEXT: ret i8 [[TMP9]]149;150 %x0 = extractelement <4 x i8> %x, i32 0151 br label %bb1152bb1:153 %x3 = extractelement <4 x i8> %x, i32 3154 %x1 = extractelement <4 x i8> %x, i32 1155 %x2 = extractelement <4 x i8> %x, i32 2156 %x0x0 = mul i8 %x0, %x0157 %x3x3 = mul i8 %x3, %x3158 %x1x1 = mul i8 %x1, %x1159 %x2x2 = mul i8 %x2, %x2160 %1 = add i8 %x0x0, %x3x3161 %2 = add i8 %x1x1, %x2x2162 %3 = sdiv i8 %1, %2163 ret i8 %3164}165