~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to test/CodeGen/AMDGPU/unroll.ll

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; RUN: opt -mtriple=amdgcn-- -loop-unroll -simplifycfg -sroa %s -S -o - | FileCheck %s
 
2
; RUN: opt -mtriple=r600-- -loop-unroll -simplifycfg -sroa %s -S -o - | FileCheck %s
 
3
 
 
4
 
 
5
; This test contains a simple loop that initializes an array declared in
 
6
; private memory.  We want to make sure these kinds of loops are always
 
7
; unrolled, because private memory is slow.
 
8
 
 
9
; CHECK-LABEL: @test
 
10
; CHECK-NOT: alloca
 
11
; CHECK: store i32 5, i32 addrspace(1)* %out
 
12
define void @test(i32 addrspace(1)* %out) {
 
13
entry:
 
14
  %0 = alloca [32 x i32]
 
15
  br label %loop.header
 
16
 
 
17
loop.header:
 
18
  %counter = phi i32 [0, %entry], [%inc, %loop.inc]
 
19
  br label %loop.body
 
20
 
 
21
loop.body:
 
22
  %ptr = getelementptr [32 x i32], [32 x i32]* %0, i32 0, i32 %counter
 
23
  store i32 %counter, i32* %ptr
 
24
  br label %loop.inc
 
25
 
 
26
loop.inc:
 
27
  %inc = add i32 %counter, 1
 
28
  %1 = icmp sge i32 %counter, 32
 
29
  br i1 %1, label  %exit, label %loop.header
 
30
 
 
31
exit:
 
32
  %2 = getelementptr [32 x i32], [32 x i32]* %0, i32 0, i32 5
 
33
  %3 = load i32, i32* %2
 
34
  store i32 %3, i32 addrspace(1)* %out
 
35
  ret void
 
36
}