1; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj -o - < %s | llvm-readelf --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:      amdhsa.kernels:
6; CHECK:        - .args:
7; CHECK-NEXT:       - .name:           a
8; CHECK-NEXT:         .offset:         0
9; CHECK-NEXT:         .size:           1
10; CHECK-NEXT:         .type_name:      char
11; CHECK-NEXT:         .value_kind:     by_value
12; CHECK-NEXT:       - .offset:         8
13; CHECK-NEXT:         .size:           8
14; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
15; CHECK-NEXT:       - .offset:         16
16; CHECK-NEXT:         .size:           8
17; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
18; CHECK-NEXT:       - .offset:         24
19; CHECK-NEXT:         .size:           8
20; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
21; CHECK-NOT:        .value_kind:    hidden_default_queue
22; CHECK-NOT:        .value_kind:    hidden_completion_action
23; CHECK:          .language:       OpenCL C
24; CHECK-NEXT:     .language_version:
25; CHECK-NEXT:       - 2
26; CHECK-NEXT:       - 0
27; CHECK:          .name:           test_non_enqueue_kernel_caller
28; CHECK:          .symbol:         test_non_enqueue_kernel_caller.kd
29define amdgpu_kernel void @test_non_enqueue_kernel_caller(i8 %a) #0
30    !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
31    !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
32  ret void
33}
34
35; CHECK:        - .args:
36; CHECK-NEXT:       - .name:           a
37; CHECK-NEXT:         .offset:         0
38; CHECK-NEXT:         .size:           1
39; CHECK-NEXT:         .type_name:      char
40; CHECK-NEXT:         .value_kind:     by_value
41; CHECK-NEXT:       - .offset:         8
42; CHECK-NEXT:         .size:           8
43; CHECK-NEXT:         .value_kind:     hidden_global_offset_x
44; CHECK-NEXT:       - .offset:         16
45; CHECK-NEXT:         .size:           8
46; CHECK-NEXT:         .value_kind:     hidden_global_offset_y
47; CHECK-NEXT:       - .offset:         24
48; CHECK-NEXT:         .size:           8
49; CHECK-NEXT:         .value_kind:     hidden_global_offset_z
50; CHECK-NEXT:       - .address_space:  global
51; CHECK-NEXT:         .offset:         32
52; CHECK-NEXT:         .size:           8
53; CHECK-NEXT:         .value_kind:     hidden_none
54; CHECK-NEXT:       - .address_space:  global
55; CHECK-NEXT:         .offset:         40
56; CHECK-NEXT:         .size:           8
57; CHECK-NEXT:         .value_kind:     hidden_default_queue
58; CHECK-NEXT:       - .address_space:  global
59; CHECK-NEXT:         .offset:         48
60; CHECK-NEXT:         .size:           8
61; CHECK-NEXT:         .value_kind:     hidden_completion_action
62; CHECK:          .language:       OpenCL C
63; CHECK-NEXT:     .language_version:
64; CHECK-NEXT:       - 2
65; CHECK-NEXT:       - 0
66; CHECK:          .name:           test_enqueue_kernel_caller
67; CHECK:          .symbol:         test_enqueue_kernel_caller.kd
68define amdgpu_kernel void @test_enqueue_kernel_caller(i8 %a) #1
69    !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3
70    !kernel_arg_base_type !3 !kernel_arg_type_qual !4 {
71  ret void
72}
73
74; CHECK:  amdhsa.version:
75; CHECK-NEXT: - 1
76; CHECK-NEXT: - 0
77; CHECK-NOT:  amdhsa.printf:
78
79attributes #0 = { "amdgpu-implicitarg-num-bytes"="48" }
80attributes #1 = { "calls-enqueue-kernel" "amdgpu-implicitarg-num-bytes"="48" }
81
82!1 = !{i32 0}
83!2 = !{!"none"}
84!3 = !{!"char"}
85!4 = !{!""}
86
87!opencl.ocl.version = !{!90}
88!90 = !{i32 2, i32 0}
89
90; PARSER: AMDGPU HSA Metadata Parser Test: PASS
91