Utilize stdint.h types for the OpenCL fixed width types in C mode
There was a comment that for some target this has been a problem. Which
one?
#ifdef __CBUILD__
-/* Define the required OpenCL C fixed size types in a C compatible way.
- The C-based kernel library implementations need these. Avoid using
- stdint.h types as it might not be available for Clang during
- kernel compilation. */
+#ifndef _TCE__
+/* Define the fixed width OpenCL data types using the target-specified ones
+ from stdint.h. */
+#include <stdint.h>
+
+typedef uint8_t uchar;
+typedef uint16_t ushort;
+typedef uint32_t uint;
+
+#ifdef __TCE__
+/* TCE's 64b support and proper stdint.h is a WiP. Workarounds here. */
+typedef unsigned ulong;
+typedef unsigned int size_t;
+/* #define double float */
+
+#else
+typedef uint64_t ulong;
+typedef __SIZE_TYPE__ size_t;
+#endif
+
+#else
+
typedef unsigned char uchar;
typedef unsigned short ushort;
-typedef unsigned int uint;
-typedef unsigned long long ulong;
+typedef unsigned uint;
+typedef unsigned ulong;
+typedef unsigned int size_t;
-typedef __SIZE_TYPE__ size_t;
+#endif
#endif
+
/* Disable undefined datatypes */
/* The definitions below intentionally lead to errors if these types
@@ -27,6 +47,8 @@ typedef __SIZE_TYPE__ size_t;
accidentally using them if the compiler does not disable these
types, but only e.g. defines them with an incorrect size.*/
+#ifndef __CBUILD__
+
#ifndef cl_khr_int64
typedef struct error_undefined_type_long error_undefined_type_long;
# define long error_undefined_type_long
@@ -34,17 +56,20 @@ typedef struct error_undefined_type_ulong error_undefined_type_ulong;
# define ulong error_undefined_type_ulong
#endif
+#endif
+
#ifdef __CBUILD__
#ifndef cl_khr_fp16
typedef short half;
#endif
#endif
-
+#ifndef __CBUILD__
#ifndef cl_khr_fp64
typedef struct error_undefined_type_double error_undefined_type_double;
# define double error_undefined_type_double
#endif
+#endif
#ifndef __CBUILD__
