[PATCH] D29718: [libclang] [OpenCL] Expose half type
Joey Gouly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 10 08:02:50 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294754: [libclang] [OpenCL] Expose half type. (authored by joey).
Changed prior to commit:
https://reviews.llvm.org/D29718?vs=87654&id=88002#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29718
Files:
cfe/trunk/bindings/python/clang/cindex.py
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/opencl-types.cl
cfe/trunk/tools/libclang/CXType.cpp
Index: cfe/trunk/include/clang-c/Index.h
===================================================================
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -3011,8 +3011,9 @@
CXType_ObjCClass = 28,
CXType_ObjCSel = 29,
CXType_Float128 = 30,
+ CXType_Half = 31,
CXType_FirstBuiltin = CXType_Void,
- CXType_LastBuiltin = CXType_ObjCSel,
+ CXType_LastBuiltin = CXType_Half,
CXType_Complex = 100,
CXType_Pointer = 101,
Index: cfe/trunk/test/Index/opencl-types.cl
===================================================================
--- cfe/trunk/test/Index/opencl-types.cl
+++ cfe/trunk/test/Index/opencl-types.cl
@@ -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]
Index: cfe/trunk/tools/libclang/CXType.cpp
===================================================================
--- cfe/trunk/tools/libclang/CXType.cpp
+++ cfe/trunk/tools/libclang/CXType.cpp
@@ -48,6 +48,7 @@
BTCASE(Long);
BTCASE(LongLong);
BTCASE(Int128);
+ BTCASE(Half);
BTCASE(Float);
BTCASE(Double);
BTCASE(LongDouble);
@@ -503,6 +504,7 @@
TKIND(Long);
TKIND(LongLong);
TKIND(Int128);
+ TKIND(Half);
TKIND(Float);
TKIND(Double);
TKIND(LongDouble);
Index: cfe/trunk/bindings/python/clang/cindex.py
===================================================================
--- cfe/trunk/bindings/python/clang/cindex.py
+++ cfe/trunk/bindings/python/clang/cindex.py
@@ -1887,6 +1887,7 @@
TypeKind.OBJCCLASS = TypeKind(28)
TypeKind.OBJCSEL = TypeKind(29)
TypeKind.FLOAT128 = TypeKind(30)
+TypeKind.HALF = TypeKind(31)
TypeKind.COMPLEX = TypeKind(100)
TypeKind.POINTER = TypeKind(101)
TypeKind.BLOCKPOINTER = TypeKind(102)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29718.88002.patch
Type: text/x-patch
Size: 2987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170210/02d5d3fa/attachment-0001.bin>
More information about the cfe-commits
mailing list