summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenCL] Allow function declaration with empty argument list.Alexey Bader2017-10-112-2/+5
| | | | | | | | | | | | | | | | Treat 'f()' as 'f(void)' rather than a function w/o a prototype. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia, yaxunl Subscribers: cfe-commits, echuraev, chapuni Differential Revision: https://reviews.llvm.org/D33681 Re-apply revision 306653. llvm-svn: 315453
* We allow implicit function declarations as an extension in all C dialects. ↵Richard Smith2017-10-042-2/+2
| | | | | | Remove OpenCL special case. llvm-svn: 314872
* [OpenCL] Fix checking of vector type castingYaxun Liu2017-10-031-1/+9
| | | | | | | | | | | | | | | | | | Currently clang allows the following code int a; int b = (const int) a; However it does not the following code int4 a; int4 b = (const int4) a; This is because Clang compares the qualified types instead of unqualified types for vector type casting, which causes the inconsistency. This patch fixes that. Differential Revision: https://reviews.llvm.org/D38463 llvm-svn: 314802
* [OpenCL] Handle taking an address of block captures.Anastasia Stulova2017-09-071-0/+11
| | | | | | | | | | | | | | | | Block captures can have different physical locations in memory segments depending on the use case (as a function call or as a kernel enqueue) and in different vendor implementations. Therefore it's unclear how to add address space to capture addresses uniformly. Currently it has been decided to disallow taking addresses of captured variables until further clarifications in the spec. Differential Revision: https://reviews.llvm.org/D36410 llvm-svn: 312728
* Remove -finclude-default-header in OpenCL atomic testsYaxun Liu2017-08-151-3/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D36676 llvm-svn: 310927
* [OpenCL] Support variable memory scope in atomic builtinsYaxun Liu2017-08-151-2/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D36580 llvm-svn: 310924
* Add OpenCL 2.0 atomic builtin functions as Clang builtinYaxun Liu2017-08-041-0/+161
| | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions. Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions. This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin functions, which supports generating LLVM atomic instructions with synchronization scope operand. Currently only constant memory scope argument is supported. Support of non-constant memory scope argument will be added later. Differential Revision: https://reviews.llvm.org/D28691 llvm-svn: 310082
* [OpenCL] Add missing subgroup builtinsJoey Gouly2017-08-011-0/+32
| | | | | | | This adds get_kernel_max_sub_group_size_for_ndrange and get_kernel_sub_group_count_for_ndrange. llvm-svn: 309678
* [OpenCL] Enable subgroup extension in testsJoey Gouly2017-07-311-1/+1
| | | | | | | This fixes the test, so that it can be run on different hosts that may have different OpenCL extensions enabled. llvm-svn: 309571
* [OpenCL] Add extension Sema check for subgroup builtinsJoey Gouly2017-07-311-0/+2
| | | | | | Check the subgroup extension is enabled, before doing other Sema checks. llvm-svn: 309567
* [OpenCL] Test on image access modifiers and image type can only be a type of ↵Egor Churaev2017-07-061-5/+28
| | | | | | | | | | | | | | a function argument. Reviewers: Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D34980 llvm-svn: 307238
* [OpenCL] Rename err_opencl_enqueue_kernel_expected_typeJoey Gouly2017-07-041-8/+8
| | | | | | | | | Rename err_opencl_enqueue_kernel_expected_type so that other builtins can use the same diagnostic. https://reviews.llvm.org/D34948 llvm-svn: 307067
* [OpenCL] Add function name to extension diagnosticJoey Gouly2017-06-301-1/+1
| | | | | | Slightly improve the diagnostic by including the function name. llvm-svn: 306827
* Revert r306653, "[OpenCL] Allow function declaration with empty argument list."NAKAMURA Takumi2017-06-292-10/+1
| | | | | | It broke bots. llvm-svn: 306660
* [OpenCL] Allow function declaration with empty argument list.Alexey Bader2017-06-292-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: does it make sense to enable K&R function declaration style for OpenCL? clang throws following error message for the declaration w/o arguments: ``` int my_func(); error: function with no prototype cannot use the spir_function calling convention ``` Current way to fix this issue is to specify that parameter list is empty by using 'void': ``` int my_func(void); ``` Let me know what do you think about this patch. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: cfe-commits, echuraev Differential Revision: https://reviews.llvm.org/D33681 llvm-svn: 306653
* [OpenCL] Diagnose scoped address-space qualified variablesAnastasia Stulova2017-06-201-0/+5
| | | | | | | | | | | | Produce an error if variables qualified with a local or a constant address space are not declared in the outermost scope of a kernel. Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D34024 llvm-svn: 305798
* [OpenCL] Harden function pointer diagnostics.Alexey Bader2017-06-021-0/+7
| | | | | | | | | | | | | | Summary: Improve OpenCL type checking by rejecting function pointer types. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33821 llvm-svn: 304575
* [OpenCL] Added diagnostic for implicit declaration of function in OpenCLEgor Churaev2017-05-302-20/+41
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D31745 llvm-svn: 304193
* [OpenCL] An error shall occur if any scalar operand has greater rank than ↵Egor Churaev2017-05-302-1/+24
| | | | | | | | | | | | | | | | | | | | the type of the vector element Summary: This is the fix for patch https://reviews.llvm.org/D33353 @uweigand, could you please verify that everything will be good on SystemZ? I added triple spir-unknown-unknown. Thank you in advance! Reviewers: uweigand Reviewed By: uweigand Subscribers: yaxunl, cfe-commits, bader, Anastasia, uweigand Differential Revision: https://reviews.llvm.org/D33648 llvm-svn: 304191
* Revert "[OpenCL] An error shall occur if any scalar operand has greater rank ↵Renato Golin2017-05-262-24/+1
| | | | | | | | | | | | | than the type of the vector element" This reverts commit r303986 as it broke all ARM and AArch64 buildbots... http://lab.llvm.org:8011/builders/clang-cmake-aarch64-39vma/builds/7007 http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/6705 http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/7509 etc. llvm-svn: 303996
* [OpenCL] An error shall occur if any scalar operand has greater rank than ↵Egor Churaev2017-05-262-1/+24
| | | | | | | | | | | | | | the type of the vector element Reviewers: Anastasia Reviewed By: Anastasia Subscribers: cfe-commits, bader, yaxunl Differential Revision: https://reviews.llvm.org/D33353 llvm-svn: 303986
* [OpenCL] reserve_id_t cannot be used as argument to kernel functionEgor Churaev2017-05-251-0/+5
| | | | | | | | | | | | Reviewers: Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits, bader Differential Revision: https://reviews.llvm.org/D33483 llvm-svn: 303846
* [OpenCL] Added regression test on invalid vector initialization.Egor Churaev2017-05-251-1/+2
| | | | | | | | | | | | | | Summary: This patch increases code coverage. Reviewers: Anastasia Reviewed By: Anastasia Subscribers: cfe-commits, bader, yaxunl Differential Revision: https://reviews.llvm.org/D33489 llvm-svn: 303844
* CodeGen: Cast alloca to expected address spaceYaxun Liu2017-05-182-18/+28
| | | | | | | | | | | Alloca always returns a pointer in alloca address space, which may be different from the type defined by the language. For example, in C++ the auto variables are in the default address space. Therefore cast alloca to the expected address space when necessary. Differential Revision: https://reviews.llvm.org/D32248 llvm-svn: 303370
* [OpenCL] Emit function-scope variable in constant address space as static ↵Yaxun Liu2017-05-151-1/+10
| | | | | | | | variable Differential Revision: https://reviews.llvm.org/D32977 llvm-svn: 303072
* [OpenCL] Handle OpenCL specific subelement typesEgor Churaev2017-05-101-0/+20
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D32898 llvm-svn: 302633
* [OpenCL] Check that global samplers are constSven van Haastregt2017-05-081-1/+7
| | | | | | | | Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D32856 llvm-svn: 302411
* [OpenCL] Add intel_reqd_sub_group_size attribute supportXiuli Pan2017-05-041-0/+4
| | | | | | | | | | | | | | | | Summary: Add intel_reqd_sub_group_size attribute support as intel extension cl_intel_required_subgroup_size from https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt Reviewers: Anastasia, bader, hfinkel, pxli168 Reviewed By: Anastasia, bader, pxli168 Subscribers: cfe-commits, yaxunl Differential Revision: https://reviews.llvm.org/D30805 llvm-svn: 302125
* [OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.Anastasia Stulova2017-04-211-3/+5
| | | | | | | | | | | Check unqualified type for ndrange argument in device_side_enqueue so device_side_enqueue accept const and volatile qualified ndranges. Differential Revision: https://reviews.llvm.org/D31458 Patch by Dmitry Borisenkov! llvm-svn: 300988
* [OpenCL] Map default address space to alloca address spaceYaxun Liu2017-04-111-0/+7
| | | | | | | | | | | | | | For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier is always mapped to target address space 0. As now target private address space is specified by alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout. This change has no impact on targets whose alloca addr space is 0. With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung Differential Revision: https://reviews.llvm.org/D31404 llvm-svn: 299965
* [OpenCL] Extended diagnostics for atomic initializationEgor Churaev2017-04-051-0/+12
| | | | | | | | | | | | | | | | | | Summary: I saw the same changes in the following review: https://reviews.llvm.org/D17438 I don't know in that way I could determine that atomic variable was initialized by macro ATOMIC_VAR_INIT. Anyway I added check that atomic variables can be initialize only in global scope. I think that we can discuss this change. Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30643 llvm-svn: 299537
* [OpenCL] Enables passing sampler initializer to function argumentEgor Churaev2017-04-051-2/+3
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: yaxunl, bader Differential Revision: https://reviews.llvm.org/D31594 llvm-svn: 299524
* [Bug 25404] Fix crash on typedef in OpenCL 2.0Anastasia Stulova2017-04-041-0/+6
| | | | | | | | | | | | | | | Fixed the assertion due to absence of source location for implicitly defined types (using addImplicitTypedef()). During Sema checks the source location is being expected and therefore an assertion is triggered. The change is not specific to OpenCL. But it is particularly common for OpenCL types to be declared implicitly in Clang to support the mode without the standard header. Differential Revision: https://reviews.llvm.org/D31397 llvm-svn: 299447
* [OpenCL] Added diagnostic for checking length of vectorEgor Churaev2017-03-211-0/+10
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30937 llvm-svn: 298369
* [OpenCL] Added implicit conversion rank for overloading functions with ↵Egor Churaev2017-03-211-29/+0
| | | | | | | | | | | | | | | | vector data type in OpenCL Summary: I added a new rank to ImplicitConversionRank enum to resolve the function overload ambiguity with vector types. Rank of scalar types conversion is lower than vector splat. So, we can choose which function should we call. See test for more details. Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30816 llvm-svn: 298366
* [OpenCL] Implement as_type operator as alias of __builtin_astype.Egor Churaev2017-03-161-4/+5
| | | | | | | | | | | | Reviewers: Anastasia Reviewed By: Anastasia Subscribers: cfe-commits, yaxunl, bader Differential Revision: https://reviews.llvm.org/D28136 llvm-svn: 297947
* clang/test/SemaOpenCL/overload_addrspace_resolution.cl: Appease MS mangler ↵NAKAMURA Takumi2017-03-101-1/+1
| | | | | | to specify triple=x86_64-unknown. llvm-svn: 297530
* [OpenCL] Fix type compatibility check and generic AS mangling.Anastasia Stulova2017-03-102-0/+66
| | | | | | | | | | | | | | | | | | | | 1. Reimplemented conditional operator so that it checks compatibility of unqualified pointees of the 2nd and the 3rd operands (C99, OpenCL v2.0 6.5.15). Define QualTypes compatibility for OpenCL as following: - corresponding types are compatible (C99 6.7.3) - CVR-qualifiers are equal (C99 6.7.3) - address spaces are equal (implementation defined) 2. Added generic address space to Itanium mangling. Review: D30037 Patch by Dmitry Borisenkov! llvm-svn: 297468
* [AMDGPU] Add builtin functions readlane ds_permute mov_dppYaxun Liu2017-03-101-5/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D30551 llvm-svn: 297436
* AMDGPU: export s_sendmsg{halt} instrinsicsJan Vesely2017-02-251-0/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D30366 llvm-svn: 296241
* AMDGPU: export s_waitcnt builtinJan Vesely2017-02-251-0/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D30359 llvm-svn: 296239
* AMDGPU: Add fmed3 half builtinMatt Arsenault2017-02-222-2/+13
| | | | llvm-svn: 295874
* [OpenCL] Correct ndrange_t implementationAnastasia Stulova2017-02-161-0/+1
| | | | | | | | | | | | | | | Removed ndrange_t as Clang builtin type and added as a struct type in the OpenCL header. Use type name to do the Sema checking in enqueue_kernel and modify IR generation accordingly. Review: D28058 Patch by Dmitry Borisenkov! llvm-svn: 295311
* [OpenCL] Disallow blocks capture other blocks (v2.0, s6.12.5)Anastasia Stulova2017-02-161-0/+15
| | | | llvm-svn: 295307
* [OpenCL] Accept logical NOT for pointer types in CL1.1Anastasia Stulova2017-02-072-57/+59
| | | | | | | | | Fix for bug 30217 - incorrect error given for logical NOT operation with a pointer type: corrected sema check and improved related tests. Review: D29038 llvm-svn: 294313
* [OpenCL] Add missing address spaces in IR generation of blocksAnastasia Stulova2017-01-271-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | Modify ObjC blocks impl wrt address spaces as follows: - keep default private address space for blocks generated as local variables (with captures); - add global address space for global block literals (no captures); - make the block invoke function and enqueue_kernel prototype with the generic AS block pointer parameter to accommodate both private and global AS cases from above; - add block handling into default AS because it's implemented as a special pointer type (BlockPointer) in the frontend and therefore it is used as a pointer everywhere. This is also needed to accommodate both private and global AS blocks for the two cases above. - removes ObjC RT specific symbols (NSConcreteStackBlock and NSConcreteGlobalBlock) in the OpenCL mode. Review: https://reviews.llvm.org/D28814 llvm-svn: 293286
* [OpenCL] Diagnose write_only image3d when extension is disabledAnastasia Stulova2017-01-251-0/+4
| | | | | | | | | | | | | | Prior to OpenCL 2.0, image3d_t can only be used with the write_only access qualifier when the cl_khr_3d_image_writes extension is enabled, see e.g. OpenCL 1.1 s6.8b. Require the extension for write_only image3d_t types and guard uses of write_only image3d_t in the OpenCL header. Patch by Sven van Haastregt! Review: https://reviews.llvm.org/D28860 llvm-svn: 293050
* [OpenCL] Improved enqueue_kernel diagnostic messageAnastasia Stulova2017-01-231-10/+10
| | | | | | | - Removed duplicated word typo. - Made coherent across multiple similar diagnostics. llvm-svn: 292804
* AMDGPU: Add builtin for getreg intrinsicMatt Arsenault2017-01-201-0/+5
| | | | llvm-svn: 292636
* [OpenCL] Re-enable supported core extensions based on opencl version when ↵Konstantin Zhuravlyov2017-01-061-0/+13
| | | | | | | | disabling all extensions using pragma Differential Revision: https://reviews.llvm.org/D28257 llvm-svn: 291243
OpenPOWER on IntegriCloud