Ehsan Amiri | a538b0f | 2016-08-03 18:17:35 +0000 | [diff] [blame] | 1 | ; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s |
Hal Finkel | cf59921 | 2015-02-25 21:36:59 +0000 | [diff] [blame] | 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 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 26 | %arrayidx3 = getelementptr inbounds [4096 x i32], [4096 x i32]* @phasor, i64 0, i64 %arrayidx.sum |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 27 | %1 = load i32, i32* %arrayidx3, align 4 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 28 | %arrayidx5 = getelementptr inbounds i32, i32* %out, i64 %indvars.iv |
Hal Finkel | cf59921 | 2015-02-25 21:36:59 +0000 | [diff] [blame] | 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 | |