Debian Codegraph @

libclc/clc/lib/r600/math/clc_fmax.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_fmax(float x, float y) {
14 // Flush denormals if not enabled. Otherwise fmax instruction flushes the
15 // values for comparison, but outputs original denormal
16 x = __clc_flush_denormal_if_not_supported(x);
17 y = __clc_flush_denormal_if_not_supported(y);
18 return __builtin_fmaxf(x, y);
19 }
20
21 #define __FLOAT_ONLY
22 #define FUNCTION __clc_fmax
23 #define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
24 #include <clc/math/gentype.inc>
25 #undef FUNCTION
26
27 #ifdef cl_khr_fp64
28
29 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
30
31 _CLC_DEF _CLC_OVERLOAD double __clc_fmax(double x, double y) {
32 return __builtin_fmax(x, y);
33 }
34
35 #define __DOUBLE_ONLY
36 #define FUNCTION __clc_fmax
37 #define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
38 #include <clc/math/gentype.inc>
39 #undef FUNCTION
40
41 #endif