[libclc] r312402 - Add halfN types and enable fp16 when generating builtin declarations

Aaron Watry via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 1 19:23:16 PDT 2017


Author: awatry
Date: Fri Sep  1 19:23:16 2017
New Revision: 312402

URL: http://llvm.org/viewvc/llvm-project?rev=312402&view=rev
Log:
Add halfN types and enable fp16 when generating builtin declarations

Uses the same mechanism to enable fp16 as we use for fp64 when
processing clc.h

Signed-off-by: Aaron Watry <awatry at gmail.com>
Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu>

Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/include/clc/clctypes.h

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=312402&r1=312401&r2=312402&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Sep  1 19:23:16 2017
@@ -8,6 +8,10 @@
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #endif
 
+#ifdef cl_khr_fp16
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#endif
+
 /* Function Attributes */
 #include <clc/clcfunc.h>
 

Modified: libclc/trunk/generic/include/clc/clctypes.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clctypes.h?rev=312402&r1=312401&r2=312402&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clctypes.h (original)
+++ libclc/trunk/generic/include/clc/clctypes.h Fri Sep  1 19:23:16 2017
@@ -85,3 +85,11 @@ typedef __attribute__((ext_vector_type(4
 typedef __attribute__((ext_vector_type(8))) double double8;
 typedef __attribute__((ext_vector_type(16))) double double16;
 #endif
+
+#ifdef cl_khr_fp16
+typedef __attribute__((ext_vector_type(2))) half half2;
+typedef __attribute__((ext_vector_type(3))) half half3;
+typedef __attribute__((ext_vector_type(4))) half half4;
+typedef __attribute__((ext_vector_type(8))) half half8;
+typedef __attribute__((ext_vector_type(16))) half half16;
+#endif




More information about the cfe-commits mailing list