• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -mtriple=r600-- -amdgpu-printf-runtime-binding -mcpu=r600 -S < %s | FileCheck --check-prefix=FUNC --check-prefix=R600 %s
2; RUN: opt -mtriple=amdgcn-- -amdgpu-printf-runtime-binding -mcpu=fiji -S < %s | FileCheck --check-prefix=FUNC --check-prefix=GCN %s
3; RUN: opt -mtriple=amdgcn--amdhsa -amdgpu-printf-runtime-binding -mcpu=fiji -S < %s | FileCheck --check-prefix=FUNC --check-prefix=GCN %s
4
5; FUNC-LABEL: @test_kernel(
6; R600-LABEL: entry
7; R600-NOT: call i8 addrspace(1)* @__printf_alloc
8; R600: call i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str, i32 0, i32 0), i8* %arraydecay, i32 %n)
9; GCN-LABEL: entry
10; GCN: call i8 addrspace(1)* @__printf_alloc
11; GCN-LABEL: entry.split
12; GCN: icmp ne i8 addrspace(1)* %printf_alloc_fn, null
13; GCN: %PrintBuffID = getelementptr i8, i8 addrspace(1)* %printf_alloc_fn, i32 0
14; GCN: %PrintBuffIdCast = bitcast i8 addrspace(1)* %PrintBuffID to i32 addrspace(1)*
15; GCN: store i32 1, i32 addrspace(1)* %PrintBuffIdCast
16; GCN: %PrintBuffGep = getelementptr i8, i8 addrspace(1)* %printf_alloc_fn, i32 4
17; GCN: %PrintArgPtr = ptrtoint i8* %arraydecay to i64
18; GCN: %PrintBuffPtrCast = bitcast i8 addrspace(1)* %PrintBuffGep to i64 addrspace(1)*
19; GCN: store i64 %PrintArgPtr, i64 addrspace(1)* %PrintBuffPtrCast
20; GCN: %PrintBuffNextPtr = getelementptr i8, i8 addrspace(1)* %PrintBuffGep, i32 8
21; GCN: %PrintBuffPtrCast1 = bitcast i8 addrspace(1)* %PrintBuffNextPtr to i32 addrspace(1)*
22; GCN: store i32 %n, i32 addrspace(1)* %PrintBuffPtrCast1
23
24@.str = private unnamed_addr addrspace(2) constant [6 x i8] c"%s:%d\00", align 1
25
26define amdgpu_kernel void @test_kernel(i32 %n) {
27entry:
28  %str = alloca [9 x i8], align 1
29  %arraydecay = getelementptr inbounds [9 x i8], [9 x i8]* %str, i32 0, i32 0
30  %call1 = call i32 (i8 addrspace(2)*, ...) @printf(i8 addrspace(2)* getelementptr inbounds ([6 x i8], [6 x i8] addrspace(2)* @.str, i32 0, i32 0), i8* %arraydecay, i32 %n)
31  ret void
32}
33
34declare i32 @printf(i8 addrspace(2)*, ...)
35