summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL
Commit message (Collapse)AuthorAgeFilesLines
* Restores r228382, which was reverted in r228406.Sameer Sahasrabuddhe2015-02-251-16/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original commit failed to handle "shift assign" (<<=), which broke the test mentioned in r228406. This is now fixed and the test added to the lit tests under SemaOpenCL. *** Original commit message from r228382 *** OpenCL: handle shift operator with vector operands Introduce a number of checks: 1. If LHS is a scalar, then RHS cannot be a vector. 2. Operands must be of integer type. 3. If both are vectors, then the number of elements must match. Relax the requirement for "usual arithmetic conversions": When LHS is a vector, a scalar RHS can simply be expanded into a vector; OpenCL does not require that its rank be lower than the LHS. For example, the following code is not an error even if the implicit type of the constant literal is "int". char2 foo(char2 v) { return v << 1; } Consolidate existing tests under CodeGenOpenCL, and add more tests under SemaOpenCL. llvm-svn: 230464
* Revert "OpenCL: handle shift operator with vector operands"Tom Stellard2015-02-061-53/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r228382. This breaks the following case: Reported by Jeroen Ketema: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20150202/122961.html typedef __attribute__((ext_vector_type(3))) char char3; void foo() { char3 v = {1,1,1}; char3 w = {1,2,3}; w <<= v; } If I compile with: clang -x cl file.c Then an error is produced: file.c:10:5: error: expression is not assignable w <<= v; ~ ^ 1 error generated. llvm-svn: 228406
* OpenCL: handle shift operator with vector operandsSameer Sahasrabuddhe2015-02-061-16/+53
| | | | | | | | | | | | | | | | | | | | Introduce a number of checks: 1. If LHS is a scalar, then RHS cannot be a vector. 2. Operands must be of integer type. 3. If both are vectors, then the number of elements must match. Relax the requirement for "usual arithmetic conversions": When LHS is a vector, a scalar RHS can simply be expanded into a vector; OpenCL does not require that its rank be lower than the LHS. For example, the following code is not an error even if the implicit type of the constant literal is "int". char2 foo(char2 v) { return v << 1; } Consolidate existing tests under CodeGenOpenCL, and add more tests under SemaOpenCL. llvm-svn: 228382
* OpenCL: handle ternary operator when the condition is a vectorSameer Sahasrabuddhe2015-02-041-3/+129
| | | | | | | | | | When the condition is a vector, OpenCL specifies additional requirements on the operand types, and also the operations required to determine the result type of the operator. This is a combination of OpenCL v1.1 s6.3.i and s6.11.6, and the semantics remain unchanged in later versions of OpenCL. llvm-svn: 228118
* Fix OpenCL 1.2 double as an optional core feature behaviourFraser Cormack2015-01-303-0/+59
| | | | | | | | | | | | | | | | | | | | In OpenCL 1.2, using double no longer requires using the pragma cl_khr_fp64, instead a kernel is allowed to use double, but must first have queried clGetDeviceInfo's CL_DEVICE_DOUBLE_FP_CONFIG. Page 197, section 6.1.1 of the OpenCL 1.2 specification has a footnote 23 describing this behaviour. I've also added test cases such that the pragma must be used if targeting OpenCL 1.0 or 1.1, but is ignored in 1.2 and 2.0. Patch by Neil Henning! Reviewers: Pekka Jääskeläinen Differential Revision: http://reviews.llvm.org/D7245 llvm-svn: 227565
* Workaround attribute ordering issue with kernel only attributesMatt Arsenault2014-12-051-0/+6
| | | | | | | | | | | Placing the attribute after the kernel keyword would incorrectly reject the attribute, so use the smae workaround that other kernel only attributes use. Also add a FIXME because there are two different phrasings now for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one. llvm-svn: 223490
* Add attributes for AMDGPU register limits.Matt Arsenault2014-12-041-0/+34
| | | | | | | This is a performance hint that can be applied to kernels to attempt to limit the number of used registers. llvm-svn: 223384
* [OpenCL] Implemented restrictions for pointer conversions specified in ↵Anastasia Stulova2014-11-261-0/+227
| | | | | | | | | | | | OpenCL v2.0. OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces: - the named address spaces (__global, __local, and __private) => __generic - implicitly converted; - __generic => named - with an explicit cast; - named <=> named - disallowed; - __constant <=> any other - disallowed. llvm-svn: 222834
* OpenCL: Emit global variables in the constant addr space as constant globalsTom Stellard2014-10-162-2/+5
| | | | llvm-svn: 219929
* OpenCL: Add -ffake-address-space-map to a testTom Stellard2014-10-161-2/+2
| | | | | | The ensures there is an explicit address space id in the output. llvm-svn: 219928
* [OpenCL] Reject reqd_work_group_size(X, Y, Z) where X, Y or Z == 0.Joey Gouly2014-05-191-0/+4
| | | | | | Patch by Pedro Ferreira! llvm-svn: 209127
* Parameter/argument terminology fixesAlp Toker2014-05-111-1/+1
| | | | llvm-svn: 208499
* Print detailed vector type information on diagnostics.Benjamin Kramer2014-04-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | We never aka vector types because our attributed syntax for it is less comprehensible than the typedefs. This leaves the user in the dark when the typedef isn't named that well. Example: v2s v; v4f w; w = v; The naming in this cases isn't even that bad, but the error we give is useless without looking up the actual typedefs. t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s' Now: t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from incompatible type 'v2s' (vector of 2 'int' values) We do this for all diagnostics that print a vector type. llvm-svn: 207267
* Disallow driver use in more Sema testsAlp Toker2014-04-191-0/+4
| | | | | | | There are now only a handful of Sema tests remaining that use %clang in SemaCXX, SemaObjC and SemaTemplate. llvm-svn: 206688
* Allow address space qualifiers on OpenCL array parametersFraser Cormack2014-04-152-0/+8
| | | | llvm-svn: 206275
* Enforce the restriction that a parameter to a kernel functionDavid Tweed2014-03-271-0/+2
| | | | | | | | | cannot be a pointer to the private address space (as clarified in the OpenCL 1.2 specification). Patch by Fraser Cormack! llvm-svn: 204941
* OpenCL: fix for the restriction on pointers to functions.Pekka Jaaskelainen2014-02-201-0/+16
| | | | | | Patch from Anastasia Stulova! llvm-svn: 201788
* Allow clang to compile the "extern" storage class in OpenCL 1.2. Pekka Jaaskelainen2014-01-231-0/+9
| | | | | | | | The tests (forgot to svn add, sorry!). Patch from Fraser Cormack! llvm-svn: 199907
* Simplifying the OpenCL image attribute. It does not need a semantic integer ↵Aaron Ballman2014-01-141-1/+2
| | | | | | parameter because the required information is encoded in the spelling. Added an appropriate subject to the attribute, and simplified the semantic checking (which will likely be expanded upon in a future patch). Also, removed the GNU spelling since it was unsupported in the first place. llvm-svn: 199229
* [OpenCL] Disallow casts between address spaces.Joey Gouly2014-01-141-0/+26
| | | | llvm-svn: 199208
* [OpenCL] Produce an error if an address space is used on the returnJoey Gouly2014-01-061-0/+12
| | | | | | type of a function. llvm-svn: 198597
* [OpenCL] Add test case for previous commit.Joey Gouly2014-01-031-0/+2
| | | | llvm-svn: 198422
* [OpenCL] Variables in the constant address space must be initialized.Joey Gouly2014-01-032-4/+4
| | | | llvm-svn: 198417
* [OpenCL] The kernel attribute can only be used on functions.Joey Gouly2014-01-021-0/+5
| | | | llvm-svn: 198300
* [OpenCL] Produce an error, instead of a warning, for sizeof(void) in OpenCL.Joey Gouly2013-12-311-0/+5
| | | | | | Patch by joey.gouly@arm.com llvm-svn: 198264
* [OpenCL] Produce an error when the work group and vec type hint attributesJoey Gouly2013-12-131-0/+11
| | | | | | | | are used on non-kernel functions. Reviewed by Aaron over IRC! llvm-svn: 197243
* [OpenCL] Make sure we put string literals in the constant address space.Joey Gouly2013-11-141-0/+13
| | | | llvm-svn: 194717
* Do not allow functions or kernels called 'main' in OpenCL.Joey Gouly2013-11-051-0/+8
| | | | llvm-svn: 194068
* Removing the endian attribute and updating associated test cases. This ↵Aaron Ballman2013-09-091-7/+1
| | | | | | functionality was never completely implemented, and this is an improvement over silently eating the attribute. llvm-svn: 190303
* OpenCL allows the (pre/post)-(increment/decrement) operator on integer ↵David Tweed2013-09-061-0/+19
| | | | | | | | | | vector types, so allow that case and add appropriate tests. Patch by Ruiling Song! llvm-svn: 190129
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-311-1/+1
| | | | | | argument list. llvm-svn: 189711
* Added the attribute name to the err_attribute_wrong_number_arguments ↵Aaron Ballman2013-07-231-2/+2
| | | | | | | | diagnostic for clarity; updated almost all of the affected test cases. Thanks to Fariborz Jahanian for the suggestion! llvm-svn: 186980
* Error on more illegal kernel argument types for OpenCLMatt Arsenault2013-07-233-2/+135
| | | | | | | | bool, half, pointers and structs / unions containing any of these are not allowed. Does not yet reject size_t and related integer types that are also disallowed. llvm-svn: 186908
* Add an error to check that all program scope variables are in the constant ↵Tanya Lattner2013-04-052-1/+3
| | | | | | address space in OpenCL. llvm-svn: 178906
* Revert 178811 until I fix the unit tests.Tanya Lattner2013-04-042-3/+1
| | | | llvm-svn: 178813
* Add an error to check that all program scope variables are in the constant ↵Tanya Lattner2013-04-042-1/+3
| | | | | | address space in OpenCL. llvm-svn: 178811
* Add support for the 'endian' attribute for OpenCL.Joey Gouly2013-03-141-0/+9
| | | | llvm-svn: 177035
* Add a test case for the 'vec_type_hint' attribute that was introduced inJoey Gouly2013-03-111-0/+16
| | | | | | r176686. I missed this file in the previous commit. llvm-svn: 176803
* Add a 64-bit triple to these tests, to fix 32-bit bots.Joey Gouly2013-02-212-2/+2
| | | | llvm-svn: 175736
* Add support to Sema and CodeGen for floating point vector types in OpenCL.Joey Gouly2013-02-212-0/+114
| | | | llvm-svn: 175734
* Diagnose loads of 'half' l-values in OpenCL.John McCall2013-02-121-15/+13
| | | | | | Patch by Joey Gouly! llvm-svn: 174928
* Enable overloading of OpenCL events - this is needed for the overloaded ↵Guy Benyei2013-02-071-0/+11
| | | | | | OpenCL builtin functions. llvm-svn: 174630
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-072-0/+25
| | | | | | restrictions. llvm-svn: 174601
* Add OpenCL error that a kernel function must have void return type. Includes ↵Tanya Lattner2013-01-301-0/+4
| | | | | | a test case. llvm-svn: 173963
* Fix a crash in OpenCL code by using the proper (RHS) bit-width.Joey Gouly2013-01-291-4/+7
| | | | llvm-svn: 173802
* Add a diagnostic for an OpenCL kernel with a pointer pointer argument.Joey Gouly2013-01-291-0/+3
| | | | | | Also refactor the surrounding code a little. llvm-svn: 173791
* Fix a non-conformant OpenCL test case.Joey Gouly2013-01-241-1/+1
| | | | | | | Program scope variables must be declared in the constant address space and are required to be initialized. llvm-svn: 173354
* Fix an OpenCL test case that was OpenCL conformant.Joey Gouly2013-01-241-0/+14
| | | | | | | | It had program scope variables that were not in the constant address space, make them to be function scope variables instead. Also move the test to the SemaOpenCL directory. llvm-svn: 173352
* Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly2013-01-231-0/+42
| | | | | | | | operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. llvm-svn: 173254
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+17
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
OpenPOWER on IntegriCloud