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