[Libclc-dev] [PATCH 1/5] Add missing as_{float,double} functions

Tom Stellard tom at stellard.net
Thu Sep 12 15:07:10 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

---
 generic/include/clc/as_type.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/generic/include/clc/as_type.h b/generic/include/clc/as_type.h
index ef7b2b1..0bb9ee2 100644
--- a/generic/include/clc/as_type.h
+++ b/generic/include/clc/as_type.h
@@ -6,6 +6,7 @@
 #define as_uint(x) __builtin_astype(x, uint)
 #define as_long(x) __builtin_astype(x, long)
 #define as_ulong(x) __builtin_astype(x, ulong)
+#define as_float(x) __builtin_astype(x, float)
 
 #define as_char2(x) __builtin_astype(x, char2)
 #define as_uchar2(x) __builtin_astype(x, uchar2)
@@ -15,6 +16,7 @@
 #define as_uint2(x) __builtin_astype(x, uint2)
 #define as_long2(x) __builtin_astype(x, long2)
 #define as_ulong2(x) __builtin_astype(x, ulong2)
+#define as_float2(x) __builtin_astype(x, float2)
 
 #define as_char3(x) __builtin_astype(x, char3)
 #define as_uchar3(x) __builtin_astype(x, uchar3)
@@ -24,6 +26,7 @@
 #define as_uint3(x) __builtin_astype(x, uint3)
 #define as_long3(x) __builtin_astype(x, long3)
 #define as_ulong3(x) __builtin_astype(x, ulong3)
+#define as_float3(x) __builtin_astype(x, float3)
 
 #define as_char4(x) __builtin_astype(x, char4)
 #define as_uchar4(x) __builtin_astype(x, uchar4)
@@ -33,6 +36,7 @@
 #define as_uint4(x) __builtin_astype(x, uint4)
 #define as_long4(x) __builtin_astype(x, long4)
 #define as_ulong4(x) __builtin_astype(x, ulong4)
+#define as_float4(x) __builtin_astype(x, float4)
 
 #define as_char8(x) __builtin_astype(x, char8)
 #define as_uchar8(x) __builtin_astype(x, uchar8)
@@ -42,6 +46,7 @@
 #define as_uint8(x) __builtin_astype(x, uint8)
 #define as_long8(x) __builtin_astype(x, long8)
 #define as_ulong8(x) __builtin_astype(x, ulong8)
+#define as_float8(x) __builtin_astype(x, float8)
 
 #define as_char16(x) __builtin_astype(x, char16)
 #define as_uchar16(x) __builtin_astype(x, uchar16)
@@ -51,3 +56,13 @@
 #define as_uint16(x) __builtin_astype(x, uint16)
 #define as_long16(x) __builtin_astype(x, long16)
 #define as_ulong16(x) __builtin_astype(x, ulong16)
+#define as_float16(x) __builtin_astype(x, float16)
+
+#ifdef cl_khr_fp64
+#define as_double(x) __builtin_astype(x, double)
+#define as_double2(x) __builtin_astype(x, double2)
+#define as_double3(x) __builtin_astype(x, double3)
+#define as_double4(x) __builtin_astype(x, double4)
+#define as_double8(x) __builtin_astype(x, double8)
+#define as_double16(x) __builtin_astype(x, double16)
+#endif
-- 
1.7.11.4





More information about the Libclc-dev mailing list