1 // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
2 // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown -cl-kernel-arg-info | FileCheck %s -check-prefix ARGINFO
4 kernel void foo(__global int * restrict X, const int Y,
5 volatile int anotherArg, __constant float * restrict Z) {
8 // CHECK: define spir_kernel void @foo{{[^!]+}}
9 // CHECK: !kernel_arg_addr_space ![[MD11:[0-9]+]]
10 // CHECK: !kernel_arg_access_qual ![[MD12:[0-9]+]]
11 // CHECK: !kernel_arg_type ![[MD13:[0-9]+]]
12 // CHECK: !kernel_arg_base_type ![[MD13]]
13 // CHECK: !kernel_arg_type_qual ![[MD14:[0-9]+]]
14 // CHECK-NOT: !kernel_arg_name
15 // ARGINFO: !kernel_arg_name ![[MD15:[0-9]+]]
17 kernel void foo2(read_only image1d_t img1, image2d_t img2, write_only image2d_array_t img3, read_write image1d_t img4) {
19 // CHECK: define spir_kernel void @foo2{{[^!]+}}
20 // CHECK: !kernel_arg_addr_space ![[MD21:[0-9]+]]
21 // CHECK: !kernel_arg_access_qual ![[MD22:[0-9]+]]
22 // CHECK: !kernel_arg_type ![[MD23:[0-9]+]]
23 // CHECK: !kernel_arg_base_type ![[MD23]]
24 // CHECK: !kernel_arg_type_qual ![[MD24:[0-9]+]]
25 // CHECK-NOT: !kernel_arg_name
26 // ARGINFO: !kernel_arg_name ![[MD25:[0-9]+]]
28 kernel void foo3(__global half * X) {
30 // CHECK: define spir_kernel void @foo3{{[^!]+}}
31 // CHECK: !kernel_arg_addr_space ![[MD31:[0-9]+]]
32 // CHECK: !kernel_arg_access_qual ![[MD32:[0-9]+]]
33 // CHECK: !kernel_arg_type ![[MD33:[0-9]+]]
34 // CHECK: !kernel_arg_base_type ![[MD33]]
35 // CHECK: !kernel_arg_type_qual ![[MD34:[0-9]+]]
36 // CHECK-NOT: !kernel_arg_name
37 // ARGINFO: !kernel_arg_name ![[MD35:[0-9]+]]
39 typedef unsigned int myunsignedint;
40 kernel void foo4(__global unsigned int * X, __global myunsignedint * Y) {
42 // CHECK: define spir_kernel void @foo4{{[^!]+}}
43 // CHECK: !kernel_arg_addr_space ![[MD41:[0-9]+]]
44 // CHECK: !kernel_arg_access_qual ![[MD42:[0-9]+]]
45 // CHECK: !kernel_arg_type ![[MD43:[0-9]+]]
46 // CHECK: !kernel_arg_base_type ![[MD44:[0-9]+]]
47 // CHECK: !kernel_arg_type_qual ![[MD45:[0-9]+]]
48 // CHECK-NOT: !kernel_arg_name
49 // ARGINFO: !kernel_arg_name ![[MD46:[0-9]+]]
51 typedef image1d_t myImage;
52 kernel void foo5(myImage img1, write_only image1d_t img2) {
54 // CHECK: define spir_kernel void @foo5{{[^!]+}}
55 // CHECK: !kernel_arg_addr_space ![[MD41:[0-9]+]]
56 // CHECK: !kernel_arg_access_qual ![[MD51:[0-9]+]]
57 // CHECK: !kernel_arg_type ![[MD52:[0-9]+]]
58 // CHECK: !kernel_arg_base_type ![[MD53:[0-9]+]]
59 // CHECK: !kernel_arg_type_qual ![[MD45]]
60 // CHECK-NOT: !kernel_arg_name
61 // ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]]
63 // CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2}
64 // CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none"}
65 // CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*"}
66 // CHECK: ![[MD14]] = !{!"restrict", !"const", !"volatile", !"restrict const"}
67 // ARGINFO: ![[MD15]] = !{!"X", !"Y", !"anotherArg", !"Z"}
68 // CHECK: ![[MD21]] = !{i32 1, i32 1, i32 1, i32 1}
69 // CHECK: ![[MD22]] = !{!"read_only", !"read_only", !"write_only", !"read_write"}
70 // CHECK: ![[MD23]] = !{!"image1d_t", !"image2d_t", !"image2d_array_t", !"image1d_t"}
71 // CHECK: ![[MD24]] = !{!"", !"", !"", !""}
72 // ARGINFO: ![[MD25]] = !{!"img1", !"img2", !"img3", !"img4"}
73 // CHECK: ![[MD31]] = !{i32 1}
74 // CHECK: ![[MD32]] = !{!"none"}
75 // CHECK: ![[MD33]] = !{!"half*"}
76 // CHECK: ![[MD34]] = !{!""}
77 // ARGINFO: ![[MD35]] = !{!"X"}
78 // CHECK: ![[MD41]] = !{i32 1, i32 1}
79 // CHECK: ![[MD42]] = !{!"none", !"none"}
80 // CHECK: ![[MD43]] = !{!"uint*", !"myunsignedint*"}
81 // CHECK: ![[MD44]] = !{!"uint*", !"uint*"}
82 // CHECK: ![[MD45]] = !{!"", !""}
83 // ARGINFO: ![[MD46]] = !{!"X", !"Y"}
84 // CHECK: ![[MD51]] = !{!"read_only", !"write_only"}
85 // CHECK: ![[MD52]] = !{!"myImage", !"image1d_t"}
86 // CHECK: ![[MD53]] = !{!"image1d_t", !"image1d_t"}
87 // ARGINFO: ![[MD54]] = !{!"img1", !"img2"}