Pushed, thanks.
On Tue, Dec 31, 2013 at 06:05:14AM +0000, Song, Ruiling wrote: > Tested ok. > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Lv Meng > Sent: Monday, December 23, 2013 12:09 PM > To: [email protected] > Cc: Lv, Meng > Subject: [Beignet] [PATCH] [PATCH]GBE: improve precision of atanh > > > Signed-off-by: Lv Meng <[email protected]> > --- > backend/src/ocl_stdlib.tmpl.h | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h > index 6ae7cd8..0dc6b0f 100755 > --- a/backend/src/ocl_stdlib.tmpl.h > +++ b/backend/src/ocl_stdlib.tmpl.h > @@ -1793,9 +1793,6 @@ INLINE_OVERLOADABLE float __gen_ocl_internal_atan(float > x) { INLINE_OVERLOADABLE float __gen_ocl_internal_atanpi(float x) { > return __gen_ocl_internal_atan(x) / M_PI_F; } -INLINE_OVERLOADABLE float > __gen_ocl_internal_atanh(float x) { > - return 0.5f * native_sqrt((1 + x) / (1 - x)); -} INLINE_OVERLOADABLE > float __gen_ocl_internal_erf(float x) { > return M_2_SQRTPI_F * (x - __gen_ocl_pow(x, 3) / 3 + __gen_ocl_pow(x, 5) / > 10 - __gen_ocl_pow(x, 7) / 42 + __gen_ocl_pow(x, 9) / 216); } @@ -2352,6 > +2349,23 @@ INLINE_OVERLOADABLE float __gen_ocl_internal_ldexp(float x, int > n) { > return x; > } > > +INLINE_OVERLOADABLE float __gen_ocl_internal_atanh(float x) { > + //return 0.5f * native_sqrt((1 + x) / (1 - x)); > + float xa = __gen_ocl_fabs (x); > + float t; > + if (isless (xa, 0.5f)){ > + if (xa < 0x1.0p-28f) return x; > + t = xa + xa; > + t = 0.5f * log1p (t + t * xa / (1.0f - xa)); > + } else if (isless (xa, 1.0f)){ > + t = 0.5f * log1p ((xa + xa) / (1.0f - xa)); > + } else{ > + if (isgreater (xa, 1.0f)) return (x - x) / (x - x); > + return x / 0.0f; > + } > + return __gen_ocl_internal_copysign(t, x); } > + > // TODO use llvm intrinsics definitions #define cos native_cos #define > cospi __gen_ocl_internal_cospi > -- > 1.7.10.4 > > _______________________________________________ > Beignet mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet > _______________________________________________ > Beignet mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
