From: Pan Xiuli <[email protected]> LLVM will combine %bc = bitcast float %x to i32 %and = and i32 %bc, 2147483647 into %and = bitcast float %fabs to i32 and fabs will ignore the denorm numbers, so need to workaround for denorm numbers.
Signed-off-by: Pan Xiuli <[email protected]> --- backend/src/libocl/tmpl/ocl_math.tmpl.cl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl index d8fa4ae..ba3b6b0 100644 --- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl @@ -2630,6 +2630,10 @@ OVERLOADABLE float nextafter(float x, float y) { hy = as_int(y); ix = hx & 0x7fffffff; iy = hy & 0x7fffffff; + if(ix == 0) + ix = hx & 0x7fffff; + if(iy == 0) + iy = hy & 0x7fffff; if(ix>0x7f800000 || iy>0x7f800000) return x+y; if(hx == hy) -- 2.5.0 _______________________________________________ Beignet mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/beignet
