Sven van Haastregt 731bf28a60 [OpenCL] Accept .rgba in OpenCL 3.0
The .rgba vector component accessors are supported in OpenCL C 3.0.

Previously, the diagnostic would check `OpenCLVersion` for version 2.2
(value 220) and report those accessors are an OpenCL 2.2 feature.
However, there is no "OpenCL C version 2.2", so change the check and
diagnostic text to 3.0 only.

A spurious `OpenCLVersion` argument was passed into the diagnostic;
remove that.

Differential Revision: https://reviews.llvm.org/D99969
2021-04-12 09:30:06 +01:00

21 lines
674 B
Common Lisp

// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL1.1
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL3.0
typedef float float4 __attribute__((ext_vector_type(4)));
void test_ext_vector_accessors(float4 V) {
V = V.wzyx;
V = V.abgr;
#if (__OPENCL_C_VERSION__ < 300)
// expected-warning@-2 {{vector component name 'a' is an OpenCL C version 3.0 feature}}
#endif
V = V.xyzr;
// expected-error@-1 {{illegal vector component name 'r'}}
#if (__OPENCL_C_VERSION__ < 300)
// expected-warning@-3 {{vector component name 'r' is an OpenCL C version 3.0 feature}}
#endif
}