1 ; RUN: opt -S -mtriple=amdgcn-amd- -amdgpu-annotate-kernel-features %s | FileCheck %s
3 ; Test to ensure recursive functions exhibit proper behaviour
4 ; Test to generate fibonacci numbers
6 ; CHECK: define i32 @fib(i32 %n) #[[FIB:[0-9]+]] {
7 define i32 @fib(i32 %n) #0 {
8 %cmp1 = icmp eq i32 %n, 0
9 br i1 %cmp1, label %exit, label %cont1
12 %cmp2 = icmp eq i32 %n, 1
13 br i1 %cmp2, label %exit, label %cont2
17 %fibm1 = call i32 @fib(i32 %nm1)
19 %fibm2 = call i32 @fib(i32 %nm2)
20 %retval = add i32 %fibm1, %fibm2
28 ; CHECK: define amdgpu_kernel void @kernel(i32 addrspace(1)* %m) #[[FIB]] {
29 define amdgpu_kernel void @kernel(i32 addrspace(1)* %m) #1 {
30 %r = call i32 @fib(i32 5)
31 store i32 %r, i32 addrspace(1)* %m
35 attributes #1 = { "uniform-work-group-size"="true" }
37 ; CHECK: attributes #[[FIB]] = { "uniform-work-group-size"="true" }