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