[Beignet] [VER_2 4/5] add exp2, exp10, expm1

Homer Hsing homer.xing at intel.com
Wed May 8 20:20:39 PDT 2013


also add their "native" version

Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 backend/src/ocl_stdlib.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h
index 5e9f87a..8a92248 100644
--- a/backend/src/ocl_stdlib.h
+++ b/backend/src/ocl_stdlib.h
@@ -414,6 +414,9 @@ INLINE OVERLOADABLE float native_tan(float x) {
   return native_sin(x) / native_cos(x);
 }
 INLINE OVERLOADABLE float native_exp(float x) { return __gen_ocl_pow(M_E_F, x); }
+INLINE OVERLOADABLE float native_exp2(float x) { return __gen_ocl_pow(2, x); }
+INLINE OVERLOADABLE float native_exp10(float x) { return __gen_ocl_pow(10, x); }
+INLINE OVERLOADABLE float __gen_ocl_internal_expm1(float x) { return __gen_ocl_pow(M_E_F, x) - 1; }
 INLINE OVERLOADABLE float __gen_ocl_internal_cbrt(float x) {
   return __gen_ocl_pow(x, 0.3333333333f);
 }
@@ -655,6 +658,9 @@ DECL_VECTOR_1OP(native_sqrt, float);
 DECL_VECTOR_1OP(native_rsqrt, float);
 DECL_VECTOR_1OP(native_log2, float);
 DECL_VECTOR_1OP(native_recip, float);
+DECL_VECTOR_1OP(native_exp2, float);
+DECL_VECTOR_1OP(native_exp10, float);
+DECL_VECTOR_1OP(__gen_ocl_internal_expm1, float);
 DECL_VECTOR_1OP(__gen_ocl_internal_cbrt, float);
 DECL_VECTOR_1OP(__gen_ocl_internal_fabs, float);
 DECL_VECTOR_1OP(__gen_ocl_internal_trunc, float);
@@ -742,6 +748,9 @@ INLINE OVERLOADABLE float16 mix(float16 x, float16 y, float a) { return mix(x,y,
 #define log2 __gen_ocl_internal_log2
 #define log10 __gen_ocl_internal_log10
 #define exp __gen_ocl_internal_exp
+#define exp2 native_exp2
+#define exp10 native_exp10
+#define expm1 __gen_ocl_internal_expm1
 #define fmin __gen_ocl_internal_fmin
 #define fmax __gen_ocl_internal_fmax
 
-- 
1.8.1.2



More information about the Beignet mailing list