brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.7 KiB · fbdca10 Raw
189 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt -mtriple=s390x-unknown-linux -mcpu=z15 -passes=slp-vectorizer %s -S -o - \3; RUN:   | FileCheck %s4 5; Test vectorization and reassociation of fmul operations. If the loads can6; be vectorized, cases of fewer operands are also profitable to vectorize.7 8define double @fmul_double_4_factors_seq(ptr nocapture noundef readonly %x) {9; CHECK-LABEL: define double @fmul_double_4_factors_seq(10; CHECK-SAME: ptr noundef readonly captures(none) [[X:%.*]]) #[[ATTR0:[0-9]+]] {11; CHECK-NEXT:  [[ENTRY:.*:]]12; CHECK-NEXT:    [[TMP0:%.*]] = load <4 x double>, ptr [[X]], align 813; CHECK-NEXT:    [[TMP1:%.*]] = call reassoc nsz arcp contract afn double @llvm.vector.reduce.fmul.v4f64(double 1.000000e+00, <4 x double> [[TMP0]])14; CHECK-NEXT:    ret double [[TMP1]]15;16entry:17  %0 = load double, ptr %x, align 818  %arrayidx1 = getelementptr inbounds double, ptr %x, i64 119  %1 = load double, ptr %arrayidx1, align 820  %mul = fmul reassoc nsz arcp contract afn double %1, %021  %arrayidx2 = getelementptr inbounds double, ptr %x, i64 222  %2 = load double, ptr %arrayidx2, align 823  %mul3 = fmul reassoc nsz arcp contract afn double %mul, %224  %arrayidx4 = getelementptr inbounds double, ptr %x, i64 325  %3 = load double, ptr %arrayidx4, align 826  %mul5 = fmul reassoc nsz arcp contract afn double %mul3, %327  ret double %mul528}29 30define double @fmul_double_8_factors_nonseq(ptr nocapture noundef readonly %x) {31; CHECK-LABEL: define double @fmul_double_8_factors_nonseq(32; CHECK-SAME: ptr noundef readonly captures(none) [[X:%.*]]) #[[ATTR0]] {33; CHECK-NEXT:  [[ENTRY:.*:]]34; CHECK-NEXT:    [[TMP0:%.*]] = load double, ptr [[X]], align 835; CHECK-NEXT:    [[ARRAYIDX1:%.*]] = getelementptr inbounds double, ptr [[X]], i64 236; CHECK-NEXT:    [[TMP1:%.*]] = load double, ptr [[ARRAYIDX1]], align 837; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds double, ptr [[X]], i64 438; CHECK-NEXT:    [[TMP2:%.*]] = load double, ptr [[ARRAYIDX2]], align 839; CHECK-NEXT:    [[ARRAYIDX4:%.*]] = getelementptr inbounds double, ptr [[X]], i64 640; CHECK-NEXT:    [[TMP3:%.*]] = load double, ptr [[ARRAYIDX4]], align 841; CHECK-NEXT:    [[ARRAYIDX6:%.*]] = getelementptr inbounds double, ptr [[X]], i64 842; CHECK-NEXT:    [[TMP4:%.*]] = load double, ptr [[ARRAYIDX6]], align 843; CHECK-NEXT:    [[ARRAYIDX8:%.*]] = getelementptr inbounds double, ptr [[X]], i64 1044; CHECK-NEXT:    [[TMP5:%.*]] = load double, ptr [[ARRAYIDX8]], align 845; CHECK-NEXT:    [[ARRAYIDX10:%.*]] = getelementptr inbounds double, ptr [[X]], i64 1246; CHECK-NEXT:    [[TMP6:%.*]] = load double, ptr [[ARRAYIDX10]], align 847; CHECK-NEXT:    [[ARRAYIDX12:%.*]] = getelementptr inbounds double, ptr [[X]], i64 1448; CHECK-NEXT:    [[TMP7:%.*]] = load double, ptr [[ARRAYIDX12]], align 849; CHECK-NEXT:    [[TMP8:%.*]] = insertelement <8 x double> poison, double [[TMP1]], i32 050; CHECK-NEXT:    [[TMP9:%.*]] = insertelement <8 x double> [[TMP8]], double [[TMP0]], i32 151; CHECK-NEXT:    [[TMP10:%.*]] = insertelement <8 x double> [[TMP9]], double [[TMP2]], i32 252; CHECK-NEXT:    [[TMP11:%.*]] = insertelement <8 x double> [[TMP10]], double [[TMP3]], i32 353; CHECK-NEXT:    [[TMP12:%.*]] = insertelement <8 x double> [[TMP11]], double [[TMP4]], i32 454; CHECK-NEXT:    [[TMP13:%.*]] = insertelement <8 x double> [[TMP12]], double [[TMP5]], i32 555; CHECK-NEXT:    [[TMP14:%.*]] = insertelement <8 x double> [[TMP13]], double [[TMP6]], i32 656; CHECK-NEXT:    [[TMP15:%.*]] = insertelement <8 x double> [[TMP14]], double [[TMP7]], i32 757; CHECK-NEXT:    [[TMP16:%.*]] = call reassoc nsz arcp contract afn double @llvm.vector.reduce.fmul.v8f64(double 1.000000e+00, <8 x double> [[TMP15]])58; CHECK-NEXT:    ret double [[TMP16]]59;60entry:61  %0 = load double, ptr %x, align 862  %arrayidx1 = getelementptr inbounds double, ptr %x, i64 263  %1 = load double, ptr %arrayidx1, align 864  %mul = fmul reassoc nsz arcp contract afn double %1, %065  %arrayidx2 = getelementptr inbounds double, ptr %x, i64 466  %2 = load double, ptr %arrayidx2, align 867  %mul3 = fmul reassoc nsz arcp contract afn double %mul, %268  %arrayidx4 = getelementptr inbounds double, ptr %x, i64 669  %3 = load double, ptr %arrayidx4, align 870  %mul5 = fmul reassoc nsz arcp contract afn double %mul3, %371  %arrayidx6 = getelementptr inbounds double, ptr %x, i64 872  %4 = load double, ptr %arrayidx6, align 873  %mul7 = fmul reassoc nsz arcp contract afn double %mul5, %474  %arrayidx8 = getelementptr inbounds double, ptr %x, i64 1075  %5 = load double, ptr %arrayidx8, align 876  %mul9 = fmul reassoc nsz arcp contract afn double %mul7, %577  %arrayidx10 = getelementptr inbounds double, ptr %x, i64 1278  %6 = load double, ptr %arrayidx10, align 879  %mul11 = fmul reassoc nsz arcp contract afn double %mul9, %680  %arrayidx12 = getelementptr inbounds double, ptr %x, i64 1481  %7 = load double, ptr %arrayidx12, align 882  %mul13 = fmul reassoc nsz arcp contract afn double %mul11, %783  ret double %mul1384}85 86define float @fmul_float_16_factors_nonseq(float noundef %m, ptr nocapture noundef readonly %x) {87; CHECK-LABEL: define float @fmul_float_16_factors_nonseq(88; CHECK-SAME: float noundef [[M:%.*]], ptr noundef readonly captures(none) [[X:%.*]]) #[[ATTR0]] {89; CHECK-NEXT:  [[ENTRY:.*:]]90; CHECK-NEXT:    [[TMP0:%.*]] = load float, ptr [[X]], align 491; CHECK-NEXT:    [[ARRAYIDX1:%.*]] = getelementptr inbounds float, ptr [[X]], i64 292; CHECK-NEXT:    [[TMP1:%.*]] = load float, ptr [[ARRAYIDX1]], align 493; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds float, ptr [[X]], i64 494; CHECK-NEXT:    [[TMP2:%.*]] = load float, ptr [[ARRAYIDX2]], align 495; CHECK-NEXT:    [[ARRAYIDX4:%.*]] = getelementptr inbounds float, ptr [[X]], i64 696; CHECK-NEXT:    [[TMP3:%.*]] = load float, ptr [[ARRAYIDX4]], align 497; CHECK-NEXT:    [[ARRAYIDX6:%.*]] = getelementptr inbounds float, ptr [[X]], i64 898; CHECK-NEXT:    [[TMP4:%.*]] = load float, ptr [[ARRAYIDX6]], align 499; CHECK-NEXT:    [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[X]], i64 10100; CHECK-NEXT:    [[TMP5:%.*]] = load float, ptr [[ARRAYIDX8]], align 4101; CHECK-NEXT:    [[ARRAYIDX10:%.*]] = getelementptr inbounds float, ptr [[X]], i64 12102; CHECK-NEXT:    [[TMP6:%.*]] = load float, ptr [[ARRAYIDX10]], align 4103; CHECK-NEXT:    [[ARRAYIDX12:%.*]] = getelementptr inbounds float, ptr [[X]], i64 14104; CHECK-NEXT:    [[TMP7:%.*]] = load float, ptr [[ARRAYIDX12]], align 4105; CHECK-NEXT:    [[ARRAYIDX14:%.*]] = getelementptr inbounds float, ptr [[X]], i64 16106; CHECK-NEXT:    [[TMP8:%.*]] = load float, ptr [[ARRAYIDX14]], align 4107; CHECK-NEXT:    [[ARRAYIDX16:%.*]] = getelementptr inbounds float, ptr [[X]], i64 18108; CHECK-NEXT:    [[TMP9:%.*]] = load float, ptr [[ARRAYIDX16]], align 4109; CHECK-NEXT:    [[ARRAYIDX18:%.*]] = getelementptr inbounds float, ptr [[X]], i64 20110; CHECK-NEXT:    [[TMP10:%.*]] = load float, ptr [[ARRAYIDX18]], align 4111; CHECK-NEXT:    [[ARRAYIDX20:%.*]] = getelementptr inbounds float, ptr [[X]], i64 22112; CHECK-NEXT:    [[TMP11:%.*]] = load float, ptr [[ARRAYIDX20]], align 4113; CHECK-NEXT:    [[ARRAYIDX22:%.*]] = getelementptr inbounds float, ptr [[X]], i64 24114; CHECK-NEXT:    [[TMP12:%.*]] = load float, ptr [[ARRAYIDX22]], align 4115; CHECK-NEXT:    [[ARRAYIDX24:%.*]] = getelementptr inbounds float, ptr [[X]], i64 26116; CHECK-NEXT:    [[TMP13:%.*]] = load float, ptr [[ARRAYIDX24]], align 4117; CHECK-NEXT:    [[ARRAYIDX26:%.*]] = getelementptr inbounds float, ptr [[X]], i64 28118; CHECK-NEXT:    [[TMP14:%.*]] = load float, ptr [[ARRAYIDX26]], align 4119; CHECK-NEXT:    [[ARRAYIDX28:%.*]] = getelementptr inbounds float, ptr [[X]], i64 30120; CHECK-NEXT:    [[TMP15:%.*]] = load float, ptr [[ARRAYIDX28]], align 4121; CHECK-NEXT:    [[TMP16:%.*]] = insertelement <16 x float> poison, float [[TMP1]], i32 0122; CHECK-NEXT:    [[TMP17:%.*]] = insertelement <16 x float> [[TMP16]], float [[TMP0]], i32 1123; CHECK-NEXT:    [[TMP18:%.*]] = insertelement <16 x float> [[TMP17]], float [[TMP2]], i32 2124; CHECK-NEXT:    [[TMP19:%.*]] = insertelement <16 x float> [[TMP18]], float [[TMP3]], i32 3125; CHECK-NEXT:    [[TMP20:%.*]] = insertelement <16 x float> [[TMP19]], float [[TMP4]], i32 4126; CHECK-NEXT:    [[TMP21:%.*]] = insertelement <16 x float> [[TMP20]], float [[TMP5]], i32 5127; CHECK-NEXT:    [[TMP22:%.*]] = insertelement <16 x float> [[TMP21]], float [[TMP6]], i32 6128; CHECK-NEXT:    [[TMP23:%.*]] = insertelement <16 x float> [[TMP22]], float [[TMP7]], i32 7129; CHECK-NEXT:    [[TMP24:%.*]] = insertelement <16 x float> [[TMP23]], float [[TMP8]], i32 8130; CHECK-NEXT:    [[TMP25:%.*]] = insertelement <16 x float> [[TMP24]], float [[TMP9]], i32 9131; CHECK-NEXT:    [[TMP26:%.*]] = insertelement <16 x float> [[TMP25]], float [[TMP10]], i32 10132; CHECK-NEXT:    [[TMP27:%.*]] = insertelement <16 x float> [[TMP26]], float [[TMP11]], i32 11133; CHECK-NEXT:    [[TMP28:%.*]] = insertelement <16 x float> [[TMP27]], float [[TMP12]], i32 12134; CHECK-NEXT:    [[TMP29:%.*]] = insertelement <16 x float> [[TMP28]], float [[TMP13]], i32 13135; CHECK-NEXT:    [[TMP30:%.*]] = insertelement <16 x float> [[TMP29]], float [[TMP14]], i32 14136; CHECK-NEXT:    [[TMP31:%.*]] = insertelement <16 x float> [[TMP30]], float [[TMP15]], i32 15137; CHECK-NEXT:    [[TMP32:%.*]] = call reassoc nsz arcp contract afn float @llvm.vector.reduce.fmul.v16f32(float 1.000000e+00, <16 x float> [[TMP31]])138; CHECK-NEXT:    ret float [[TMP32]]139;140entry:141  %0 = load float, ptr %x, align 4142  %arrayidx1 = getelementptr inbounds float, ptr %x, i64 2143  %1 = load float, ptr %arrayidx1, align 4144  %mul = fmul reassoc nsz arcp contract afn float %1, %0145  %arrayidx2 = getelementptr inbounds float, ptr %x, i64 4146  %2 = load float, ptr %arrayidx2, align 4147  %mul3 = fmul reassoc nsz arcp contract afn float %mul, %2148  %arrayidx4 = getelementptr inbounds float, ptr %x, i64 6149  %3 = load float, ptr %arrayidx4, align 4150  %mul5 = fmul reassoc nsz arcp contract afn float %mul3, %3151  %arrayidx6 = getelementptr inbounds float, ptr %x, i64 8152  %4 = load float, ptr %arrayidx6, align 4153  %mul7 = fmul reassoc nsz arcp contract afn float %mul5, %4154  %arrayidx8 = getelementptr inbounds float, ptr %x, i64 10155  %5 = load float, ptr %arrayidx8, align 4156  %mul9 = fmul reassoc nsz arcp contract afn float %mul7, %5157  %arrayidx10 = getelementptr inbounds float, ptr %x, i64 12158  %6 = load float, ptr %arrayidx10, align 4159  %mul11 = fmul reassoc nsz arcp contract afn float %mul9, %6160  %arrayidx12 = getelementptr inbounds float, ptr %x, i64 14161  %7 = load float, ptr %arrayidx12, align 4162  %mul13 = fmul reassoc nsz arcp contract afn float %mul11, %7163  %arrayidx14 = getelementptr inbounds float, ptr %x, i64 16164  %8 = load float, ptr %arrayidx14, align 4165  %mul15 = fmul reassoc nsz arcp contract afn float %mul13, %8166  %arrayidx16 = getelementptr inbounds float, ptr %x, i64 18167  %9 = load float, ptr %arrayidx16, align 4168  %mul17 = fmul reassoc nsz arcp contract afn float %mul15, %9169  %arrayidx18 = getelementptr inbounds float, ptr %x, i64 20170  %10 = load float, ptr %arrayidx18, align 4171  %mul19 = fmul reassoc nsz arcp contract afn float %mul17, %10172  %arrayidx20 = getelementptr inbounds float, ptr %x, i64 22173  %11 = load float, ptr %arrayidx20, align 4174  %mul21 = fmul reassoc nsz arcp contract afn float %mul19, %11175  %arrayidx22 = getelementptr inbounds float, ptr %x, i64 24176  %12 = load float, ptr %arrayidx22, align 4177  %mul23 = fmul reassoc nsz arcp contract afn float %mul21, %12178  %arrayidx24 = getelementptr inbounds float, ptr %x, i64 26179  %13 = load float, ptr %arrayidx24, align 4180  %mul25 = fmul reassoc nsz arcp contract afn float %mul23, %13181  %arrayidx26 = getelementptr inbounds float, ptr %x, i64 28182  %14 = load float, ptr %arrayidx26, align 4183  %mul27 = fmul reassoc nsz arcp contract afn float %mul25, %14184  %arrayidx28 = getelementptr inbounds float, ptr %x, i64 30185  %15 = load float, ptr %arrayidx28, align 4186  %mul29 = fmul reassoc nsz arcp contract afn float %mul27, %15187  ret float %mul29188}189