Debian Codegraph @

libclc/clc/lib/r600/math/clc_fmin.cl

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include <clc/clcmacro.h>
10 #include <clc/internal/clc.h>
11 #include <clc/math/math.h>
12
13 _CLC_DEF _CLC_OVERLOAD float __clc_fmin(float x, float y) {
14 // fcanonicalize removes sNaNs and flushes denormals if not enabled. Otherwise
15 // fmin instruction flushes the values for comparison, but outputs original
16 // denormal
17 x = __clc_flush_denormal_if_not_supported(x);
18 y = __clc_flush_denormal_if_not_supported(y);
19 return __builtin_fminf(x, y);
20 }
21
22 #define __FLOAT_ONLY
23 #define FUNCTION __clc_fmin
24 #define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
25 #include <clc/math/gentype.inc>
26 #undef FUNCTION
27
28 #ifdef cl_khr_fp64
29
30 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
31
32 _CLC_DEF _CLC_OVERLOAD double __clc_fmin(double x, double y) {
33 return __builtin_fmin(x, y);
34 }
35
36 #define __DOUBLE_ONLY
37 #define FUNCTION __clc_fmin
38 #define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
39 #include <clc/math/gentype.inc>
40 #undef FUNCTION
41
42 #endif