forked from OSchip/llvm-project
[OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021
`.rgba` vector extension setting in C++ for OpenCL 2021 is now performed analogously to OpenCL C 3.0. Test case added. Differential Revision: https://reviews.llvm.org/D109370
This commit is contained in:
parent
44a889778c
commit
09dc454b00
|
@ -340,7 +340,8 @@ CheckExtVectorComponent(Sema &S, QualType baseType, ExprValueKind &VK,
|
|||
|
||||
// Emit a warning if an rgba selector is used earlier than OpenCL C 3.0.
|
||||
if (HasRGBA || (*compStr && IsRGBA(*compStr))) {
|
||||
if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion < 300) {
|
||||
if (S.getLangOpts().OpenCL &&
|
||||
S.getLangOpts().getOpenCLCompatibleVersion() < 300) {
|
||||
const char *DiagBegin = HasRGBA ? CompName->getNameStart() : compStr;
|
||||
S.Diag(OpLoc, diag::ext_opencl_ext_vector_type_rgba_selector)
|
||||
<< StringRef(DiagBegin, 1) << SourceRange(CompLoc);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
|
||||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
|
||||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++1.0
|
||||
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=clc++2021
|
||||
|
||||
typedef float float4 __attribute__((ext_vector_type(4)));
|
||||
|
||||
|
@ -9,13 +10,13 @@ void test_ext_vector_accessors(float4 V) {
|
|||
V = V.wzyx;
|
||||
|
||||
V = V.abgr;
|
||||
#if (__OPENCL_C_VERSION__ < 300)
|
||||
#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 300) || (defined(__OPENCL_CPP_VERSION__) && __OPENCL_CPP_VERSION__ < 202100))
|
||||
// expected-warning@-2 {{vector component name 'a' is a feature from OpenCL version 3.0 onwards}}
|
||||
#endif
|
||||
|
||||
V = V.xyzr;
|
||||
// expected-error@-1 {{illegal vector component name 'r'}}
|
||||
#if (__OPENCL_C_VERSION__ < 300)
|
||||
#if ((defined(__OPENCL_C_VERSION__) && __OPENCL_C_VERSION__ < 300) || (defined(__OPENCL_CPP_VERSION__) && __OPENCL_CPP_VERSION__ < 202100))
|
||||
// expected-warning@-3 {{vector component name 'r' is a feature from OpenCL version 3.0 onwards}}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue