blob: 2604ed4e574c043e43df370a2ab1395495a2b1e1 [file] [log] [blame]
Jan Vesely4b1243f2017-02-18 04:24:10 +00001; RUN: opt -loop-unroll -unroll-threshold=2000 -S < %s | llc -march=r600 -mcpu=cypress | FileCheck %s
NAKAMURA Takumi486dfe12017-02-19 02:31:06 +00002; REQUIRES: asserts
Jan Vesely4b1243f2017-02-18 04:24:10 +00003
Jan Vesely3ea17042017-03-06 20:10:05 +00004; CHECK: {{^}}alu_limits:
5; CHECK: CF_END
Jan Vesely4b1243f2017-02-18 04:24:10 +00006
7%struct.foo = type {i32, i32, i32}
8
Matt Arsenault3dbeefa2017-03-21 21:39:51 +00009define amdgpu_kernel void @alu_limits(i32 addrspace(1)* %out, %struct.foo* %in, i32 %offset) {
Jan Vesely4b1243f2017-02-18 04:24:10 +000010entry:
11 %ptr = getelementptr inbounds %struct.foo, %struct.foo* %in, i32 1, i32 2
12 %x = load i32, i32 *%ptr, align 4
13 br label %loop
14loop:
15 %i = phi i32 [ 100, %entry ], [ %nexti, %loop ]
16 %val = phi i32 [ 1, %entry ], [ %nextval, %loop ]
17
18 %nexti = sub i32 %i, 1
19
20 %y = xor i32 %x, %i
21 %nextval = mul i32 %val, %y
22
23 %cond = icmp ne i32 %nexti, 0
24 br i1 %cond, label %loop, label %end
25end:
26 %out_val = add i32 %nextval, 4
27 store i32 %out_val, i32 addrspace(1)* %out, align 4
28 ret void
29}