summaryrefslogtreecommitdiffstats
path: root/test/SemaOpenCL
Commit message (Collapse)AuthorAgeFilesLines
...
* We allow implicit function declarations as an extension in all C dialects. ↵Richard Smith2017-10-042-2/+2
| | | | | | Remove OpenCL special case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314872 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314802 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312728 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove -finclude-default-header in OpenCL atomic testsYaxun Liu2017-08-151-3/+24
| | | | | | | Differential Revision: https://reviews.llvm.org/D36676 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310927 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Support variable memory scope in atomic builtinsYaxun Liu2017-08-151-2/+15
| | | | | | | Differential Revision: https://reviews.llvm.org/D36580 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310924 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310082 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309678 91177308-0d34-0410-b5e6-96231b3b80d8
* [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309571 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add extension Sema check for subgroup builtinsJoey Gouly2017-07-311-0/+2
| | | | | | | Check the subgroup extension is enabled, before doing other Sema checks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309567 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307238 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307067 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add function name to extension diagnosticJoey Gouly2017-06-301-1/+1
| | | | | | | Slightly improve the diagnostic by including the function name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306827 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r306653, "[OpenCL] Allow function declaration with empty argument list."NAKAMURA Takumi2017-06-292-10/+1
| | | | | | It broke bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306660 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306653 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305798 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304575 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304193 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304191 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303996 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303986 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303846 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303844 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303370 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303072 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302633 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Check that global samplers are constSven van Haastregt2017-05-081-1/+7
| | | | | | | | | | Patch by Simon Perretta. Differential Revision: https://reviews.llvm.org/D32856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302411 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302125 91177308-0d34-0410-b5e6-96231b3b80d8
* [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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300988 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299965 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299537 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299524 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299447 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298369 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298366 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297947 91177308-0d34-0410-b5e6-96231b3b80d8
* clang/test/SemaOpenCL/overload_addrspace_resolution.cl: Appease MS mangler ↵NAKAMURA Takumi2017-03-101-1/+1
| | | | | | to specify triple=x86_64-unknown. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297530 91177308-0d34-0410-b5e6-96231b3b80d8
* [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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297468 91177308-0d34-0410-b5e6-96231b3b80d8
* [AMDGPU] Add builtin functions readlane ds_permute mov_dppYaxun Liu2017-03-101-5/+15
| | | | | | | Differential Revision: https://reviews.llvm.org/D30551 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297436 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: export s_sendmsg{halt} instrinsicsJan Vesely2017-02-251-0/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D30366 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296241 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: export s_waitcnt builtinJan Vesely2017-02-251-0/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D30359 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296239 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: Add fmed3 half builtinMatt Arsenault2017-02-222-2/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295874 91177308-0d34-0410-b5e6-96231b3b80d8
* [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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295311 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Disallow blocks capture other blocks (v2.0, s6.12.5)Anastasia Stulova2017-02-161-0/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295307 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294313 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293286 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293050 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Improved enqueue_kernel diagnostic messageAnastasia Stulova2017-01-231-10/+10
| | | | | | | | | - Removed duplicated word typo. - Made coherent across multiple similar diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292804 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: Add builtin for getreg intrinsicMatt Arsenault2017-01-201-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292636 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291243 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Align fake address space map with the SPIR target maps.Egor Churaev2016-12-231-1/+1
| | | | | | | | | | | | | | | Summary: We compile user opencl kernel code with spir triple. But built-ins are written in OpenCL and we compile it with triple x86_64 to be able to use x86 intrinsics. And we need address spaces to match in both cases. So, we change fake address space map in OpenCL for matching with spir. On CPU address spaces are not really important but we'd like to preserve address space information in order to perform optimizations relying on this info like enhanced alias analysis. Reviewers: pekka.jaaskelainen, Anastasia Subscribers: pekka.jaaskelainen, yaxunl, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D28048 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290436 91177308-0d34-0410-b5e6-96231b3b80d8