1#include <clc/clc.h> 2#include <clc/clcmacro.h> 3#include <clc/math/math.h> 4 5_CLC_DEF _CLC_OVERLOAD float fmin(float x, float y) 6{ 7 /* fcanonicalize removes sNaNs and flushes denormals if not enabled. 8 * Otherwise fmin instruction flushes the values for comparison, 9 * but outputs original denormal */ 10 x = __clc_flush_denormal_if_not_supported(x); 11 y = __clc_flush_denormal_if_not_supported(y); 12 return __builtin_fminf(x, y); 13} 14_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, fmin, float, float) 15 16#ifdef cl_khr_fp64 17 18#pragma OPENCL EXTENSION cl_khr_fp64 : enable 19 20_CLC_DEF _CLC_OVERLOAD double fmin(double x, double y) 21{ 22 return __builtin_fmin(x, y); 23} 24_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, fmin, double, double) 25 26#endif 27 28#define __CLC_BODY <../../../generic/lib/math/fmin.inc> 29#include <clc/math/gentype.inc> 30