Debian Codegraph @

clang/test/SemaOpenCL/amd-media-ops.cl

raw
1 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops,+cl_amd_media_ops2 -verify -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header
2 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops,+cl_amd_media_ops2 -verify -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header -fdeclare-opencl-builtins
3 // expected-no-diagnostics
4 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops2 -verify=ops -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header
5 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops -verify=ops2 -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header
6 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops2 -verify=ops -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header -fdeclare-opencl-builtins
7 // RUN: %clang_cc1 %s -triple amdgcn-unknown-unknown -cl-ext=-all,+cl_amd_media_ops -verify=ops2 -pedantic -Wconversion -Werror -fsyntax-only -cl-std=CL -finclude-default-header -fdeclare-opencl-builtins
8
9 #define TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
10 ret test_ ## builtin ## _ ## ret ## _## type (type a) { \
11 return builtin(a); \
12 }
13
14 #define TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
15 ret test_ ## builtin ## _ ## ret ## _## type (type a, type b) { \
16 return builtin(a, b); \
17 }
18
19 #define TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
20 ret test_ ## builtin ## _ ## ret ## _ ## type (type a, type b, type c) { \
21 return builtin(a, b, c); \
22 }
23
24 #define TEST_1ARG_BUILTIN(builtin, ret, type) \
25 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
26 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret ## 2, type ## 2) \
27 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret ## 3, type ## 3) \
28 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret ## 4, type ## 4) \
29 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret ## 8, type ## 8) \
30 TEST_1ARG_BUILTIN_WITH_TYPE(builtin, ret ## 16, type ## 16)
31
32 #define TEST_2ARG_BUILTIN(builtin, ret, type) \
33 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
34 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret ## 2, type ## 2) \
35 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret ## 3, type ## 3) \
36 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret ## 4, type ## 4) \
37 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret ## 8, type ## 8) \
38 TEST_2ARG_BUILTIN_WITH_TYPE(builtin, ret ## 16, type ## 16)
39
40 #define TEST_3ARG_BUILTIN(builtin, ret, type) \
41 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret, type) \
42 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret ## 2, type ## 2) \
43 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret ## 3, type ## 3) \
44 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret ## 4, type ## 4) \
45 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret ## 8, type ## 8) \
46 TEST_3ARG_BUILTIN_WITH_TYPE(builtin, ret ## 16, type ## 16)
47
48 #define TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret, type_a, type_b, type_c) \
49 ret test_ ## builtin ## _ ## ret ## _ ## type_a ## _ ## type_b ## _ ## type_c (type_a a, type_b b, type_c c) { \
50 return builtin(a, b, c); \
51 }
52
53 #define TEST_3ARG_WITH_TYPES_BUILTIN(builtin, ret, type_a, type_b, type_c) \
54 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret, type_a, type_b, type_c) \
55 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret ## 2, type_a ## 2, type_b ## 2, type_c ## 2) \
56 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret ## 3, type_a ## 3, type_b ## 3, type_c ## 3) \
57 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret ## 4, type_a ## 4, type_b ## 4, type_c ## 4) \
58 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret ## 8, type_a ## 8, type_b ## 8, type_c ## 8) \
59 TEST_3ARG_BUILTIN_WITH_TYPES(builtin, ret ## 16, type_a ## 16, type_b ## 16, type_c ## 16)
60
61 TEST_3ARG_BUILTIN(amd_bitalign, uint, uint) // ops-error 6 {{use of undeclared identifier}}
62 TEST_3ARG_BUILTIN(amd_bytealign, uint, uint) // ops-error 6 {{use of undeclared identifier}}
63 TEST_3ARG_BUILTIN(amd_lerp, uint, uint) // ops-error 6 {{use of undeclared identifier}}
64
65 uint test_amd_pack(float4 a) {
66 return amd_pack(a); // ops-error{{use of undeclared identifier}}
67 }
68
69 uint test_amd_sad4(uint4 a, uint4 b, uint c) {
70 return amd_sad4(a, b, c); // ops-error{{use of undeclared identifier}}
71 }
72
73 TEST_3ARG_BUILTIN(amd_sadhi, uint, uint)// ops-error 6 {{use of undeclared identifier}}
74 TEST_3ARG_BUILTIN(amd_sad, uint, uint) // ops-error 6 {{use of undeclared identifier}}
75
76
77 TEST_1ARG_BUILTIN(amd_unpack0, float, uint) // ops-error 6 {{use of undeclared identifier}}
78 TEST_1ARG_BUILTIN(amd_unpack1, float, uint) // ops-error 6 {{use of undeclared identifier}}
79 TEST_1ARG_BUILTIN(amd_unpack2, float, uint) // ops-error 6 {{use of undeclared identifier}}
80 TEST_1ARG_BUILTIN(amd_unpack3, float, uint) // ops-error 6 {{use of undeclared identifier}}
81
82 TEST_3ARG_WITH_TYPES_BUILTIN(amd_bfe, int, int, uint, uint) // ops2-error 6 {{use of undeclared identifier}} #amd_bfe0
83 TEST_3ARG_BUILTIN(amd_bfe, uint, uint) // ops2-error 6 {{use of undeclared identifier}} #amd_bfe1
84 TEST_2ARG_BUILTIN(amd_bfm, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
85
86 TEST_3ARG_BUILTIN(amd_max3, float, float) // ops2-error 6 {{use of undeclared identifier}}
87 TEST_3ARG_BUILTIN(amd_max3, int, int) // ops2-error 6 {{use of undeclared identifier}}
88 TEST_3ARG_BUILTIN(amd_max3, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
89
90 TEST_3ARG_BUILTIN(amd_median3, float, float) // ops2-error 6 {{use of undeclared identifier}}
91 TEST_3ARG_BUILTIN(amd_median3, int, int) // ops2-error 6 {{use of undeclared identifier}}
92 TEST_3ARG_BUILTIN(amd_median3, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
93
94 TEST_3ARG_BUILTIN(amd_min3, float, float) // ops2-error 6 {{use of undeclared identifier}}
95 TEST_3ARG_BUILTIN(amd_min3, int, int) // ops2-error 6 {{use of undeclared identifier}}
96 TEST_3ARG_BUILTIN(amd_min3, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
97
98 TEST_3ARG_WITH_TYPES_BUILTIN(amd_mqsad, ulong, ulong, uint, ulong) // ops2-error 6 {{use of undeclared identifier}}
99 TEST_3ARG_WITH_TYPES_BUILTIN(amd_qsad, ulong, ulong, uint, ulong) // ops2-error 6 {{use of undeclared identifier}}
100
101 TEST_3ARG_BUILTIN(amd_msad, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
102 TEST_3ARG_BUILTIN(amd_sadd, uint, uint) // ops2-error 6 {{use of undeclared identifier}}
103 TEST_3ARG_BUILTIN(amd_sadw, uint, uint) // ops2-error 6 {{use of undeclared identifier}}