[Beignet] [PATCH] Enable built-in sub_sat/add_sat vector type.
Ruiling Song
ruiling.song at intel.com
Sun Jun 2 19:53:21 PDT 2013
also fix a typo in DECL_VECTOR_2OP macro.
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
backend/src/ocl_stdlib.h | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h
index 613b844..808109d 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -921,7 +921,7 @@ DECL_VECTOR_1OP(__gen_ocl_internal_erfc, float);
#define DECL_VECTOR_2OP(NAME, TYPE) \
INLINE OVERLOADABLE TYPE##2 NAME(TYPE##2 v0, TYPE##2 v1) { \
- return (TYPE##2)(NAME(v0.x, v1.x), NAME(v1.y, v1.y)); \
+ return (TYPE##2)(NAME(v0.x, v1.x), NAME(v0.y, v1.y)); \
}\
INLINE OVERLOADABLE TYPE##3 NAME(TYPE##3 v0, TYPE##3 v1) { \
return (TYPE##3)(NAME(v0.x, v1.x), NAME(v0.y, v1.y), NAME(v0.z, v1.z)); \
@@ -954,6 +954,23 @@ DECL_VECTOR_2OP(native_divide, float);
DECL_VECTOR_2OP(copysign, float);
DECL_VECTOR_2OP(__gen_ocl_internal_maxmag, float);
DECL_VECTOR_2OP(__gen_ocl_internal_minmag, float);
+
+DECL_VECTOR_2OP(add_sat, char);
+DECL_VECTOR_2OP(add_sat, short);
+DECL_VECTOR_2OP(add_sat, int);
+DECL_VECTOR_2OP(add_sat, long);
+DECL_VECTOR_2OP(sub_sat, char);
+DECL_VECTOR_2OP(sub_sat, short);
+DECL_VECTOR_2OP(sub_sat, int);
+DECL_VECTOR_2OP(sub_sat, long);
+DECL_VECTOR_2OP(add_sat, uchar);
+DECL_VECTOR_2OP(add_sat, ushort);
+DECL_VECTOR_2OP(add_sat, uint);
+DECL_VECTOR_2OP(add_sat, ulong);
+DECL_VECTOR_2OP(sub_sat, uchar);
+DECL_VECTOR_2OP(sub_sat, ushort);
+DECL_VECTOR_2OP(sub_sat, uint);
+DECL_VECTOR_2OP(sub_sat, ulong);
#undef DECL_VECTOR_2OP
#define DECL_VECTOR_2OP(NAME, TYPE, TYPE2) \
--
1.7.9.5
More information about the Beignet
mailing list