1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readobj -elf-output-style=GNU -notes | FileCheck --check-prefix=CHECK --check-prefix=GFX900 --check-prefix=NOTES %s
2; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -amdgpu-dump-hsa-metadata -amdgpu-verify-hsa-metadata -filetype=obj -o - < %s 2>&1 | FileCheck --check-prefix=PARSER %s
3
4; CHECK: ---
5; CHECK:  Version: [ 1, 0 ]
6; CHECK-NOT:  Printf:
7; CHECK:  Kernels:
8
9; CHECK:      - Name:            test_non_enqueue_kernel_caller
10; CHECK-NEXT:   SymbolName:      'test_non_enqueue_kernel_caller@kd'
11; CHECK-NEXT:   Language:        OpenCL C
12; CHECK-NEXT:   LanguageVersion: [ 2, 0 ]
13; CHECK-NEXT:   Args:
14; CHECK-NEXT:     - Name:          a
15; CHECK-NEXT:       TypeName:      char
16; CHECK-NEXT:       Size:          1
17; CHECK-NEXT:       Align:         1
18; CHECK-NEXT:       ValueKind:     ByValue
19; CHECK-NEXT:       ValueType:     I8
20; CHECK-NEXT:       AccQual:       Default
21; CHECK-NEXT:     - Size:          8
22; CHECK-NEXT:       Align:         8
23; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetX
24; CHECK-NEXT:       ValueType:     I64
25; CHECK-NEXT:     - Size:          8
26; CHECK-NEXT:       Align:         8
27; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetY
28; CHECK-NEXT:       ValueType:     I64
29; CHECK-NEXT:     - Size:          8
30; CHECK-NEXT:       Align:         8
31; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetZ
32; CHECK-NEXT:       ValueType:     I64
33; CHECK-NOT:        ValueKind:     HiddenDefaultQueue
34; CHECK-NOT:        ValueKind:     HiddenCompletionAction
35define amdgpu_kernel void @test_non_enqueue_kernel_caller(i8 %a) #0
36    !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
37    !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
38  ret void
39}
40
41; CHECK:      - Name:            test_enqueue_kernel_caller
42; CHECK-NEXT:   SymbolName:      'test_enqueue_kernel_caller@kd'
43; CHECK-NEXT:   Language:        OpenCL C
44; CHECK-NEXT:   LanguageVersion: [ 2, 0 ]
45; CHECK-NEXT:   Args:
46; CHECK-NEXT:     - Name:          a
47; CHECK-NEXT:       TypeName:      char
48; CHECK-NEXT:       Size:          1
49; CHECK-NEXT:       Align:         1
50; CHECK-NEXT:       ValueKind:     ByValue
51; CHECK-NEXT:       ValueType:     I8
52; CHECK-NEXT:       AccQual:       Default
53; CHECK-NEXT:     - Size:          8
54; CHECK-NEXT:       Align:         8
55; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetX
56; CHECK-NEXT:       ValueType:     I64
57; CHECK-NEXT:     - Size:          8
58; CHECK-NEXT:       Align:         8
59; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetY
60; CHECK-NEXT:       ValueType:     I64
61; CHECK-NEXT:     - Size:          8
62; CHECK-NEXT:       Align:         8
63; CHECK-NEXT:       ValueKind:     HiddenGlobalOffsetZ
64; CHECK-NEXT:       ValueType:     I64
65; CHECK-NEXT:     - Size:          8
66; CHECK-NEXT:       Align:         8
67; CHECK-NEXT:       ValueKind:     HiddenNone
68; CHECK-NEXT:       ValueType:     I8
69; CHECK-NEXT:       AddrSpaceQual: Global
70; CHECK-NEXT:     - Size:          8
71; CHECK-NEXT:       Align:         8
72; CHECK-NEXT:       ValueKind:     HiddenDefaultQueue
73; CHECK-NEXT:       ValueType:     I8
74; CHECK-NEXT:       AddrSpaceQual: Global
75; CHECK-NEXT:     - Size:          8
76; CHECK-NEXT:       Align:         8
77; CHECK-NEXT:       ValueKind:     HiddenCompletionAction
78; CHECK-NEXT:       ValueType:     I8
79; CHECK-NEXT:       AddrSpaceQual: Global
80define amdgpu_kernel void @test_enqueue_kernel_caller(i8 %a) #1
81    !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
82    !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
83  ret void
84}
85
86attributes #0 = { "amdgpu-implicitarg-num-bytes"="48" }
87attributes #1 = { "calls-enqueue-kernel" "amdgpu-implicitarg-num-bytes"="48" }
88
89!1 = !{i32 0}
90!2 = !{!"none"}
91!3 = !{!"char"}
92!4 = !{!""}
93
94!opencl.ocl.version = !{!90}
95!90 = !{i32 2, i32 0}
96
97; PARSER: AMDGPU HSA Metadata Parser Test: PASS
98