1*a050b255SChen Zheng; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2*a050b255SChen Zheng; RUN: llc -mcpu=pwr9 -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s 3*a050b255SChen Zheng 4*a050b255SChen Zheng; void foo(float *data, float d) { 5*a050b255SChen Zheng; long i; 6*a050b255SChen Zheng; for (i = 0; i < 8000; i++) 7*a050b255SChen Zheng; data[i] = d; 8*a050b255SChen Zheng; } 9*a050b255SChen Zheng; 10*a050b255SChen Zheng; This loop will be unrolled by 96 and vectorized on power9. 11*a050b255SChen Zheng; icmp for loop iteration index and loop trip count(384) has LSRUse for 'reg({0,+,384})'. 12*a050b255SChen Zheng; Make sure above icmp does not impact LSR choose best formulae sets based on 'reg({(192 + %0),+,384})' 13*a050b255SChen Zheng 14*a050b255SChen Zhengdefine void @foo(float* nocapture %data, float %d) { 15*a050b255SChen Zheng; CHECK-LABEL: foo: 16*a050b255SChen Zheng; CHECK: .LBB0_1: # %vector.body 17*a050b255SChen Zheng; CHECK: add 5, 3, 4 18*a050b255SChen Zheng; CHECK-NEXT: stxvx 0, 3, 4 19*a050b255SChen Zheng; CHECK-NEXT: addi 4, 4, 384 20*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 16(5) 21*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 32(5) 22*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 48(5) 23*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 64(5) 24*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 80(5) 25*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 96(5) 26*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 112(5) 27*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 128(5) 28*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 144(5) 29*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 160(5) 30*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 176(5) 31*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 192(5) 32*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 208(5) 33*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 224(5) 34*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 240(5) 35*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 256(5) 36*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 272(5) 37*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 288(5) 38*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 304(5) 39*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 320(5) 40*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 336(5) 41*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 352(5) 42*a050b255SChen Zheng; CHECK-NEXT: stxv 0, 368(5) 43*a050b255SChen Zheng; CHECK-NEXT: bdnz .LBB0_1 44*a050b255SChen Zheng 45*a050b255SChen Zhengentry: 46*a050b255SChen Zheng %broadcast.splatinsert16 = insertelement <4 x float> undef, float %d, i32 0 47*a050b255SChen Zheng %broadcast.splat17 = shufflevector <4 x float> %broadcast.splatinsert16, <4 x float> undef, <4 x i32> zeroinitializer 48*a050b255SChen Zheng %broadcast.splatinsert18 = insertelement <4 x float> undef, float %d, i32 0 49*a050b255SChen Zheng %broadcast.splat19 = shufflevector <4 x float> %broadcast.splatinsert18, <4 x float> undef, <4 x i32> zeroinitializer 50*a050b255SChen Zheng %broadcast.splatinsert20 = insertelement <4 x float> undef, float %d, i32 0 51*a050b255SChen Zheng %broadcast.splat21 = shufflevector <4 x float> %broadcast.splatinsert20, <4 x float> undef, <4 x i32> zeroinitializer 52*a050b255SChen Zheng %broadcast.splatinsert22 = insertelement <4 x float> undef, float %d, i32 0 53*a050b255SChen Zheng %broadcast.splat23 = shufflevector <4 x float> %broadcast.splatinsert22, <4 x float> undef, <4 x i32> zeroinitializer 54*a050b255SChen Zheng %broadcast.splatinsert24 = insertelement <4 x float> undef, float %d, i32 0 55*a050b255SChen Zheng %broadcast.splat25 = shufflevector <4 x float> %broadcast.splatinsert24, <4 x float> undef, <4 x i32> zeroinitializer 56*a050b255SChen Zheng %broadcast.splatinsert26 = insertelement <4 x float> undef, float %d, i32 0 57*a050b255SChen Zheng %broadcast.splat27 = shufflevector <4 x float> %broadcast.splatinsert26, <4 x float> undef, <4 x i32> zeroinitializer 58*a050b255SChen Zheng %broadcast.splatinsert28 = insertelement <4 x float> undef, float %d, i32 0 59*a050b255SChen Zheng %broadcast.splat29 = shufflevector <4 x float> %broadcast.splatinsert28, <4 x float> undef, <4 x i32> zeroinitializer 60*a050b255SChen Zheng %broadcast.splatinsert30 = insertelement <4 x float> undef, float %d, i32 0 61*a050b255SChen Zheng %broadcast.splat31 = shufflevector <4 x float> %broadcast.splatinsert30, <4 x float> undef, <4 x i32> zeroinitializer 62*a050b255SChen Zheng %broadcast.splatinsert32 = insertelement <4 x float> undef, float %d, i32 0 63*a050b255SChen Zheng %broadcast.splat33 = shufflevector <4 x float> %broadcast.splatinsert32, <4 x float> undef, <4 x i32> zeroinitializer 64*a050b255SChen Zheng %broadcast.splatinsert34 = insertelement <4 x float> undef, float %d, i32 0 65*a050b255SChen Zheng %broadcast.splat35 = shufflevector <4 x float> %broadcast.splatinsert34, <4 x float> undef, <4 x i32> zeroinitializer 66*a050b255SChen Zheng %broadcast.splatinsert36 = insertelement <4 x float> undef, float %d, i32 0 67*a050b255SChen Zheng %broadcast.splat37 = shufflevector <4 x float> %broadcast.splatinsert36, <4 x float> undef, <4 x i32> zeroinitializer 68*a050b255SChen Zheng %broadcast.splatinsert38 = insertelement <4 x float> undef, float %d, i32 0 69*a050b255SChen Zheng %broadcast.splat39 = shufflevector <4 x float> %broadcast.splatinsert38, <4 x float> undef, <4 x i32> zeroinitializer 70*a050b255SChen Zheng br label %vector.body 71*a050b255SChen Zheng 72*a050b255SChen Zhengvector.body: ; preds = %vector.body, %entry 73*a050b255SChen Zheng %index = phi i64 [ 0, %entry ], [ %index.next.1, %vector.body ] 74*a050b255SChen Zheng %0 = getelementptr inbounds float, float* %data, i64 %index 75*a050b255SChen Zheng %1 = bitcast float* %0 to <4 x float>* 76*a050b255SChen Zheng store <4 x float> %broadcast.splat17, <4 x float>* %1, align 4 77*a050b255SChen Zheng %2 = getelementptr inbounds float, float* %0, i64 4 78*a050b255SChen Zheng %3 = bitcast float* %2 to <4 x float>* 79*a050b255SChen Zheng store <4 x float> %broadcast.splat19, <4 x float>* %3, align 4 80*a050b255SChen Zheng %4 = getelementptr inbounds float, float* %0, i64 8 81*a050b255SChen Zheng %5 = bitcast float* %4 to <4 x float>* 82*a050b255SChen Zheng store <4 x float> %broadcast.splat21, <4 x float>* %5, align 4 83*a050b255SChen Zheng %6 = getelementptr inbounds float, float* %0, i64 12 84*a050b255SChen Zheng %7 = bitcast float* %6 to <4 x float>* 85*a050b255SChen Zheng store <4 x float> %broadcast.splat23, <4 x float>* %7, align 4 86*a050b255SChen Zheng %8 = getelementptr inbounds float, float* %0, i64 16 87*a050b255SChen Zheng %9 = bitcast float* %8 to <4 x float>* 88*a050b255SChen Zheng store <4 x float> %broadcast.splat25, <4 x float>* %9, align 4 89*a050b255SChen Zheng %10 = getelementptr inbounds float, float* %0, i64 20 90*a050b255SChen Zheng %11 = bitcast float* %10 to <4 x float>* 91*a050b255SChen Zheng store <4 x float> %broadcast.splat27, <4 x float>* %11, align 4 92*a050b255SChen Zheng %12 = getelementptr inbounds float, float* %0, i64 24 93*a050b255SChen Zheng %13 = bitcast float* %12 to <4 x float>* 94*a050b255SChen Zheng store <4 x float> %broadcast.splat29, <4 x float>* %13, align 4 95*a050b255SChen Zheng %14 = getelementptr inbounds float, float* %0, i64 28 96*a050b255SChen Zheng %15 = bitcast float* %14 to <4 x float>* 97*a050b255SChen Zheng store <4 x float> %broadcast.splat31, <4 x float>* %15, align 4 98*a050b255SChen Zheng %16 = getelementptr inbounds float, float* %0, i64 32 99*a050b255SChen Zheng %17 = bitcast float* %16 to <4 x float>* 100*a050b255SChen Zheng store <4 x float> %broadcast.splat33, <4 x float>* %17, align 4 101*a050b255SChen Zheng %18 = getelementptr inbounds float, float* %0, i64 36 102*a050b255SChen Zheng %19 = bitcast float* %18 to <4 x float>* 103*a050b255SChen Zheng store <4 x float> %broadcast.splat35, <4 x float>* %19, align 4 104*a050b255SChen Zheng %20 = getelementptr inbounds float, float* %0, i64 40 105*a050b255SChen Zheng %21 = bitcast float* %20 to <4 x float>* 106*a050b255SChen Zheng store <4 x float> %broadcast.splat37, <4 x float>* %21, align 4 107*a050b255SChen Zheng %22 = getelementptr inbounds float, float* %0, i64 44 108*a050b255SChen Zheng %23 = bitcast float* %22 to <4 x float>* 109*a050b255SChen Zheng store <4 x float> %broadcast.splat39, <4 x float>* %23, align 4 110*a050b255SChen Zheng %index.next = add nuw nsw i64 %index, 48 111*a050b255SChen Zheng %24 = getelementptr inbounds float, float* %data, i64 %index.next 112*a050b255SChen Zheng %25 = bitcast float* %24 to <4 x float>* 113*a050b255SChen Zheng store <4 x float> %broadcast.splat17, <4 x float>* %25, align 4 114*a050b255SChen Zheng %26 = getelementptr inbounds float, float* %24, i64 4 115*a050b255SChen Zheng %27 = bitcast float* %26 to <4 x float>* 116*a050b255SChen Zheng store <4 x float> %broadcast.splat19, <4 x float>* %27, align 4 117*a050b255SChen Zheng %28 = getelementptr inbounds float, float* %24, i64 8 118*a050b255SChen Zheng %29 = bitcast float* %28 to <4 x float>* 119*a050b255SChen Zheng store <4 x float> %broadcast.splat21, <4 x float>* %29, align 4 120*a050b255SChen Zheng %30 = getelementptr inbounds float, float* %24, i64 12 121*a050b255SChen Zheng %31 = bitcast float* %30 to <4 x float>* 122*a050b255SChen Zheng store <4 x float> %broadcast.splat23, <4 x float>* %31, align 4 123*a050b255SChen Zheng %32 = getelementptr inbounds float, float* %24, i64 16 124*a050b255SChen Zheng %33 = bitcast float* %32 to <4 x float>* 125*a050b255SChen Zheng store <4 x float> %broadcast.splat25, <4 x float>* %33, align 4 126*a050b255SChen Zheng %34 = getelementptr inbounds float, float* %24, i64 20 127*a050b255SChen Zheng %35 = bitcast float* %34 to <4 x float>* 128*a050b255SChen Zheng store <4 x float> %broadcast.splat27, <4 x float>* %35, align 4 129*a050b255SChen Zheng %36 = getelementptr inbounds float, float* %24, i64 24 130*a050b255SChen Zheng %37 = bitcast float* %36 to <4 x float>* 131*a050b255SChen Zheng store <4 x float> %broadcast.splat29, <4 x float>* %37, align 4 132*a050b255SChen Zheng %38 = getelementptr inbounds float, float* %24, i64 28 133*a050b255SChen Zheng %39 = bitcast float* %38 to <4 x float>* 134*a050b255SChen Zheng store <4 x float> %broadcast.splat31, <4 x float>* %39, align 4 135*a050b255SChen Zheng %40 = getelementptr inbounds float, float* %24, i64 32 136*a050b255SChen Zheng %41 = bitcast float* %40 to <4 x float>* 137*a050b255SChen Zheng store <4 x float> %broadcast.splat33, <4 x float>* %41, align 4 138*a050b255SChen Zheng %42 = getelementptr inbounds float, float* %24, i64 36 139*a050b255SChen Zheng %43 = bitcast float* %42 to <4 x float>* 140*a050b255SChen Zheng store <4 x float> %broadcast.splat35, <4 x float>* %43, align 4 141*a050b255SChen Zheng %44 = getelementptr inbounds float, float* %24, i64 40 142*a050b255SChen Zheng %45 = bitcast float* %44 to <4 x float>* 143*a050b255SChen Zheng store <4 x float> %broadcast.splat37, <4 x float>* %45, align 4 144*a050b255SChen Zheng %46 = getelementptr inbounds float, float* %24, i64 44 145*a050b255SChen Zheng %47 = bitcast float* %46 to <4 x float>* 146*a050b255SChen Zheng store <4 x float> %broadcast.splat39, <4 x float>* %47, align 4 147*a050b255SChen Zheng %index.next.1 = add nuw nsw i64 %index, 96 148*a050b255SChen Zheng %48 = icmp eq i64 %index.next.1, 7968 149*a050b255SChen Zheng br i1 %48, label %for.body, label %vector.body 150*a050b255SChen Zheng 151*a050b255SChen Zhengfor.body: ; preds = %vector.body 152*a050b255SChen Zheng %arrayidx = getelementptr inbounds float, float* %data, i64 7968 153*a050b255SChen Zheng store float %d, float* %arrayidx, align 4 154*a050b255SChen Zheng %arrayidx.1 = getelementptr inbounds float, float* %data, i64 7969 155*a050b255SChen Zheng store float %d, float* %arrayidx.1, align 4 156*a050b255SChen Zheng %arrayidx.2 = getelementptr inbounds float, float* %data, i64 7970 157*a050b255SChen Zheng store float %d, float* %arrayidx.2, align 4 158*a050b255SChen Zheng %arrayidx.3 = getelementptr inbounds float, float* %data, i64 7971 159*a050b255SChen Zheng store float %d, float* %arrayidx.3, align 4 160*a050b255SChen Zheng %arrayidx.4 = getelementptr inbounds float, float* %data, i64 7972 161*a050b255SChen Zheng store float %d, float* %arrayidx.4, align 4 162*a050b255SChen Zheng %arrayidx.5 = getelementptr inbounds float, float* %data, i64 7973 163*a050b255SChen Zheng store float %d, float* %arrayidx.5, align 4 164*a050b255SChen Zheng %arrayidx.6 = getelementptr inbounds float, float* %data, i64 7974 165*a050b255SChen Zheng store float %d, float* %arrayidx.6, align 4 166*a050b255SChen Zheng %arrayidx.7 = getelementptr inbounds float, float* %data, i64 7975 167*a050b255SChen Zheng store float %d, float* %arrayidx.7, align 4 168*a050b255SChen Zheng %arrayidx.8 = getelementptr inbounds float, float* %data, i64 7976 169*a050b255SChen Zheng store float %d, float* %arrayidx.8, align 4 170*a050b255SChen Zheng %arrayidx.9 = getelementptr inbounds float, float* %data, i64 7977 171*a050b255SChen Zheng store float %d, float* %arrayidx.9, align 4 172*a050b255SChen Zheng %arrayidx.10 = getelementptr inbounds float, float* %data, i64 7978 173*a050b255SChen Zheng store float %d, float* %arrayidx.10, align 4 174*a050b255SChen Zheng %arrayidx.11 = getelementptr inbounds float, float* %data, i64 7979 175*a050b255SChen Zheng store float %d, float* %arrayidx.11, align 4 176*a050b255SChen Zheng %arrayidx.12 = getelementptr inbounds float, float* %data, i64 7980 177*a050b255SChen Zheng store float %d, float* %arrayidx.12, align 4 178*a050b255SChen Zheng %arrayidx.13 = getelementptr inbounds float, float* %data, i64 7981 179*a050b255SChen Zheng store float %d, float* %arrayidx.13, align 4 180*a050b255SChen Zheng %arrayidx.14 = getelementptr inbounds float, float* %data, i64 7982 181*a050b255SChen Zheng store float %d, float* %arrayidx.14, align 4 182*a050b255SChen Zheng %arrayidx.15 = getelementptr inbounds float, float* %data, i64 7983 183*a050b255SChen Zheng store float %d, float* %arrayidx.15, align 4 184*a050b255SChen Zheng %arrayidx.16 = getelementptr inbounds float, float* %data, i64 7984 185*a050b255SChen Zheng store float %d, float* %arrayidx.16, align 4 186*a050b255SChen Zheng %arrayidx.17 = getelementptr inbounds float, float* %data, i64 7985 187*a050b255SChen Zheng store float %d, float* %arrayidx.17, align 4 188*a050b255SChen Zheng %arrayidx.18 = getelementptr inbounds float, float* %data, i64 7986 189*a050b255SChen Zheng store float %d, float* %arrayidx.18, align 4 190*a050b255SChen Zheng %arrayidx.19 = getelementptr inbounds float, float* %data, i64 7987 191*a050b255SChen Zheng store float %d, float* %arrayidx.19, align 4 192*a050b255SChen Zheng %arrayidx.20 = getelementptr inbounds float, float* %data, i64 7988 193*a050b255SChen Zheng store float %d, float* %arrayidx.20, align 4 194*a050b255SChen Zheng %arrayidx.21 = getelementptr inbounds float, float* %data, i64 7989 195*a050b255SChen Zheng store float %d, float* %arrayidx.21, align 4 196*a050b255SChen Zheng %arrayidx.22 = getelementptr inbounds float, float* %data, i64 7990 197*a050b255SChen Zheng store float %d, float* %arrayidx.22, align 4 198*a050b255SChen Zheng %arrayidx.23 = getelementptr inbounds float, float* %data, i64 7991 199*a050b255SChen Zheng store float %d, float* %arrayidx.23, align 4 200*a050b255SChen Zheng %arrayidx.24 = getelementptr inbounds float, float* %data, i64 7992 201*a050b255SChen Zheng store float %d, float* %arrayidx.24, align 4 202*a050b255SChen Zheng %arrayidx.25 = getelementptr inbounds float, float* %data, i64 7993 203*a050b255SChen Zheng store float %d, float* %arrayidx.25, align 4 204*a050b255SChen Zheng %arrayidx.26 = getelementptr inbounds float, float* %data, i64 7994 205*a050b255SChen Zheng store float %d, float* %arrayidx.26, align 4 206*a050b255SChen Zheng %arrayidx.27 = getelementptr inbounds float, float* %data, i64 7995 207*a050b255SChen Zheng store float %d, float* %arrayidx.27, align 4 208*a050b255SChen Zheng %arrayidx.28 = getelementptr inbounds float, float* %data, i64 7996 209*a050b255SChen Zheng store float %d, float* %arrayidx.28, align 4 210*a050b255SChen Zheng %arrayidx.29 = getelementptr inbounds float, float* %data, i64 7997 211*a050b255SChen Zheng store float %d, float* %arrayidx.29, align 4 212*a050b255SChen Zheng %arrayidx.30 = getelementptr inbounds float, float* %data, i64 7998 213*a050b255SChen Zheng store float %d, float* %arrayidx.30, align 4 214*a050b255SChen Zheng %arrayidx.31 = getelementptr inbounds float, float* %data, i64 7999 215*a050b255SChen Zheng store float %d, float* %arrayidx.31, align 4 216*a050b255SChen Zheng ret void 217*a050b255SChen Zheng} 218