[Beignet] [PATCH] add same type converting
Song, Ruiling
ruiling.song at intel.com
Thu Oct 31 05:41:55 CET 2013
LGTM. Thanks!
-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Homer Hsing
Sent: Thursday, October 31, 2013 11:13 AM
To: beignet at lists.freedesktop.org
Subject: [Beignet] [PATCH] add same type converting
converting a data type to same type ...
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
backend/src/gen_convert.sh | 3 ---
backend/src/ocl_convert.h | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/backend/src/gen_convert.sh b/backend/src/gen_convert.sh index 0d84e50..30d8876 100755
--- a/backend/src/gen_convert.sh
+++ b/backend/src/gen_convert.sh
@@ -9,9 +9,6 @@ for vector_length in $VECTOR_LENGTHS; do
fbasetype=`IFS=:; set -- dummy $ftype; echo $2`
for ttype in $TYPES; do
tbasetype=`IFS=:; set -- dummy $ttype; echo $2`
- if test $fbasetype = $tbasetype; then
- continue
- fi
echo "INLINE OVERLOADABLE $tbasetype convert_$tbasetype($fbasetype v) {"
echo " return ($tbasetype)v;"
echo "}"
diff --git a/backend/src/ocl_convert.h b/backend/src/ocl_convert.h index 76519c4..d78d697 100644
--- a/backend/src/ocl_convert.h
+++ b/backend/src/ocl_convert.h
@@ -1,5 +1,9 @@
// This file is autogenerated by gen_convert.sh.
// Don't modify it manually.
+INLINE OVERLOADABLE long convert_long(long v) {
+ return (long)v;
+}
+
INLINE OVERLOADABLE ulong convert_ulong(long v) {
return (ulong)v;
}
@@ -40,6 +44,10 @@ INLINE OVERLOADABLE long convert_long(ulong v) {
return (long)v;
}
+INLINE OVERLOADABLE ulong convert_ulong(ulong v) {
+ return (ulong)v;
+}
+
INLINE OVERLOADABLE int convert_int(ulong v) {
return (int)v;
}
@@ -80,6 +88,10 @@ INLINE OVERLOADABLE ulong convert_ulong(int v) {
return (ulong)v;
}
+INLINE OVERLOADABLE int convert_int(int v) {
+ return (int)v;
+}
+
INLINE OVERLOADABLE uint convert_uint(int v) {
return (uint)v;
}
@@ -120,6 +132,10 @@ INLINE OVERLOADABLE int convert_int(uint v) {
return (int)v;
}
+INLINE OVERLOADABLE uint convert_uint(uint v) {
+ return (uint)v;
+}
+
INLINE OVERLOADABLE short convert_short(uint v) {
return (short)v;
}
@@ -160,6 +176,10 @@ INLINE OVERLOADABLE uint convert_uint(short v) {
return (uint)v;
}
+INLINE OVERLOADABLE short convert_short(short v) {
+ return (short)v;
+}
+
INLINE OVERLOADABLE ushort convert_ushort(short v) {
return (ushort)v;
}
@@ -200,6 +220,10 @@ INLINE OVERLOADABLE short convert_short(ushort v) {
return (short)v;
}
+INLINE OVERLOADABLE ushort convert_ushort(ushort v) {
+ return (ushort)v;
+}
+
INLINE OVERLOADABLE char convert_char(ushort v) {
return (char)v;
}
@@ -240,6 +264,10 @@ INLINE OVERLOADABLE ushort convert_ushort(char v) {
return (ushort)v;
}
+INLINE OVERLOADABLE char convert_char(char v) {
+ return (char)v;
+}
+
INLINE OVERLOADABLE uchar convert_uchar(char v) {
return (uchar)v;
}
@@ -280,6 +308,10 @@ INLINE OVERLOADABLE char convert_char(uchar v) {
return (char)v;
}
+INLINE OVERLOADABLE uchar convert_uchar(uchar v) {
+ return (uchar)v;
+}
+
INLINE OVERLOADABLE double convert_double(uchar v) {
return (double)v;
}
@@ -320,6 +352,10 @@ INLINE OVERLOADABLE uchar convert_uchar(double v) {
return (uchar)v;
}
+INLINE OVERLOADABLE double convert_double(double v) {
+ return (double)v;
+}
+
INLINE OVERLOADABLE float convert_float(double v) {
return (float)v;
}
@@ -360,6 +396,10 @@ INLINE OVERLOADABLE double convert_double(float v) {
return (double)v;
}
+INLINE OVERLOADABLE float convert_float(float v) {
+ return (float)v;
+}
+
INLINE OVERLOADABLE long2 convert_long2(long2 v) { return v; } INLINE OVERLOADABLE ulong2 convert_ulong2(long2 v) {
return (ulong2)((ulong)(v.s0), (ulong)(v.s1));
--
1.8.3.2
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list