forked from llvm-mirror/clang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libclang] [OpenCL] Expose half type.
Expose the half type (fp16) through libclang and the python bindings. It seems CXType_LastBuiltin was not updated in b2ea6d9 ("Enable support for __float128 in Clang", 2016-04-13), so update it now. Add an Index test for OpenCL types; in the future we will add other OpenCL types such as images to this test. Patch by Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D29718 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294754 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
4 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: c-index-test -test-print-type %s | FileCheck %s | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable | ||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
|
||
typedef half half4 __attribute__((ext_vector_type(4))); | ||
typedef float float4 __attribute__((ext_vector_type(4))); | ||
typedef double double4 __attribute__((ext_vector_type(4))); | ||
|
||
void kernel testFloatTypes() { | ||
half scalarHalf; | ||
half4 vectorHalf; | ||
float scalarFloat; | ||
float4 vectorFloat; | ||
double scalarDouble; | ||
double4 vectorDouble; | ||
} | ||
|
||
// CHECK: VarDecl=scalarHalf:11:8 (Definition) [type=half] [typekind=Half] [isPOD=1] | ||
// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] | ||
// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1] | ||
// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] | ||
// CHECK: VarDecl=scalarDouble:15:10 (Definition) [type=double] [typekind=Double] [isPOD=1] | ||
// CHECK: VarDecl=vectorDouble:16:11 (Definition) [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters