LGTM, will push latter. Thanks.
On Thu, Jan 29, 2015 at 04:05:42PM +0800, Ruiling Song wrote: > Avoid if-branching. > > Signed-off-by: Ruiling Song <[email protected]> > --- > backend/src/libocl/tmpl/ocl_math.tmpl.cl | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl > b/backend/src/libocl/tmpl/ocl_math.tmpl.cl > index 49c4efa..3483945 100644 > --- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl > +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl > @@ -1280,18 +1280,16 @@ OVERLOADABLE float logb(float x) { > if (__ocl_math_fastpath_flag) > return __gen_ocl_internal_fastpath_logb(x); > > -union {float f; unsigned i;} u; > + union {float f; unsigned i;} u; > u.f = x; > int e = ((u.i & 0x7f800000) >> 23); > - if(e == 0) { > + float r1 = e-127; > + float r2 = -INFINITY; > + float r3 = x*x; > /* sub normal or +/-0 */ > - return -INFINITY; > - } else if(e == 0xff) { > + float r = e == 0 ? r2 : r1; > /* inf & nan */ > - return x*x; > - } else { > - return (float)(e-127); > - } > + return e == 0xff ? r3 : r; > } > > OVERLOADABLE int ilogb(float x) { > -- > 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
