[Beignet] [PATCH] fix builtin function "fmax"
Zhigang Gong
zhigang.gong at linux.intel.com
Thu Nov 7 21:08:52 PST 2013
LGTM, thanks.
On Fri, Nov 08, 2013 at 10:51:34AM +0800, Homer Hsing wrote:
> if an parameter is nan, then returns another parameter.
>
> Signed-off-by: Homer Hsing <homer.xing at intel.com>
> ---
> backend/src/ocl_stdlib.tmpl.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
> index bff2b1c..ec9ed60 100644
> --- a/backend/src/ocl_stdlib.tmpl.h
> +++ b/backend/src/ocl_stdlib.tmpl.h
> @@ -1621,6 +1621,10 @@ INLINE_OVERLOADABLE float step(float edge, float x) {
>
> #define DECL_MIN_MAX_CLAMP(TYPE) \
> INLINE_OVERLOADABLE TYPE max(TYPE a, TYPE b) { \
> + if (isnan(a)) \
> + return b; \
> + if (isnan(b)) \
> + return a; \
> return a > b ? a : b; \
> } \
> INLINE_OVERLOADABLE TYPE min(TYPE a, TYPE b) { \
> --
> 1.8.3.2
>
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list