1 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s
2 target datalayout = "E-m:e-i64:64-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 @phasor = external constant [4096 x i32]
7 ; Function Attrs: nounwind
8 define void @test(ptr nocapture %out, i32 zeroext %step_size) #0 {
10 %shl = shl i32 %step_size, 2
11 %idxprom = zext i32 %shl to i64
14 ; Make sure that the TOC load has been hoisted out of the loop.
16 ; CHECK: ld {{[0-9]+}}, .LC{{[0-9]+}}@toc@l
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], ptr @phasor, i64 0, i64 %arrayidx.sum
27 %1 = load i32, ptr %arrayidx3, align 4
28 %arrayidx5 = getelementptr inbounds i32, ptr %out, i64 %indvars.iv
29 store i32 %1, ptr %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
34 for.end: ; preds = %for.body
38 attributes #0 = { nounwind }