forked from OSchip/llvm-project
Implement fmin using __builtin_fmin
This ensures correct handling of NaN. This has been tested with piglit, OpenCV, and the ocl conformance tests. llvm-svn: 233712
This commit is contained in:
parent
e782178e9c
commit
310da7bfd2
|
@ -1,8 +1,5 @@
|
|||
#undef fmin
|
||||
#define fmin __clc_fmin
|
||||
|
||||
#define __CLC_BODY <clc/math/binary_decl.inc>
|
||||
#define __CLC_FUNCTION __clc_fmin
|
||||
#define __CLC_FUNCTION fmin
|
||||
|
||||
#include <clc/math/gentype.inc>
|
||||
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#include <clc/clc.h>
|
||||
|
||||
#include "../clcmacro.h"
|
||||
|
||||
_CLC_DEFINE_BINARY_BUILTIN(float, fmin, __builtin_fminf, float, float);
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
|
||||
_CLC_DEFINE_BINARY_BUILTIN(double, fmin, __builtin_fmin, double, double);
|
||||
|
||||
#endif
|
||||
|
||||
#define FUNCTION __clc_fmin
|
||||
#define FUNCTION_IMPL(x, y) ((y) < (x) ? (y) : (x))
|
||||
|
||||
#define __CLC_BODY <binary_impl.inc>
|
||||
#define __CLC_BODY <fmin.inc>
|
||||
#include <clc/math/gentype.inc>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
#if !defined(__CLC_SCALAR)
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmin(__CLC_GENTYPE x, float y) {
|
||||
return fmin(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y));
|
||||
}
|
||||
|
||||
#ifdef cl_khr_fp64
|
||||
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
|
||||
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fmin(__CLC_GENTYPE x, double y) {
|
||||
return fmin(x, (__CLC_GENTYPE)((__CLC_SCALAR_GENTYPE)y));
|
||||
}
|
||||
|
||||
#endif // ifdef cl_khr_fp64
|
||||
|
||||
#endif // !defined(__CLC_SCALAR)
|
Loading…
Reference in New Issue