1 ; RUN: llc -mcpu=pwr7 < %s | FileCheck %s 2 target datalayout = "E-m:e-i64:64-n32:64" 3 target triple = "powerpc64-unknown-linux-gnu" 4 5 @phasor = external constant [4096 x i32] 6 7 ; Function Attrs: nounwind 8 define void @test(i32* nocapture %out, i32 zeroext %step_size) #0 { 9 entry: 10 %shl = shl i32 %step_size, 2 11 %idxprom = zext i32 %shl to i64 12 br label %for.body 13 14 ; Make sure that the TOC load has been hoisted out of the loop. 15 ; CHECK-LABEL: @test 16 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc@l 17 ; CHECK: %for.body 18 ; CHECK: blr 19 20 for.body: ; preds = %entry, %for.body 21 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 22 %0 = trunc i64 %indvars.iv to i32 23 %shl1 = shl i32 %0, %step_size 24 %idxprom2 = sext i32 %shl1 to i64 25 %arrayidx.sum = add nsw i64 %idxprom2, %idxprom 26 %arrayidx3 = getelementptr inbounds [4096 x i32], [4096 x i32]* @phasor, i64 0, i64 %arrayidx.sum 27 %1 = load i32, i32* %arrayidx3, align 4 28 %arrayidx5 = getelementptr inbounds i32, i32* %out, i64 %indvars.iv 29 store i32 %1, i32* %arrayidx5, align 4 30 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 4 31 %cmp = icmp slt i64 %indvars.iv.next, 1020 32 br i1 %cmp, label %for.body, label %for.end 33 34 for.end: ; preds = %for.body 35 ret void 36 } 37 38 attributes #0 = { nounwind } 39 40