|
| 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/relational/clc_isnan.h> |
| 12 | + |
| 13 | +#define __FLOAT_ONLY |
| 14 | +#define __CLC_MIN_VECSIZE 1 |
| 15 | +#define FUNCTION __clc_fmax |
| 16 | +#define __IMPL_FUNCTION __builtin_fmaxf |
| 17 | +#define __CLC_BODY <clc/shared/binary_def_scalarize.inc> |
| 18 | +#include <clc/math/gentype.inc> |
| 19 | +#undef __CLC_MIN_VECSIZE |
| 20 | +#undef FUNCTION |
| 21 | +#undef __IMPL_FUNCTION |
| 22 | + |
| 23 | +#ifdef cl_khr_fp64 |
| 24 | + |
| 25 | +#pragma OPENCL EXTENSION cl_khr_fp64 : enable |
| 26 | + |
| 27 | +#define __DOUBLE_ONLY |
| 28 | +#define __CLC_MIN_VECSIZE 1 |
| 29 | +#define FUNCTION __clc_fmax |
| 30 | +#define __IMPL_FUNCTION __builtin_fmax |
| 31 | +#define __CLC_BODY <clc/shared/binary_def_scalarize.inc> |
| 32 | +#include <clc/math/gentype.inc> |
| 33 | +#undef __CLC_MIN_VECSIZE |
| 34 | +#undef FUNCTION |
| 35 | +#undef __IMPL_FUNCTION |
| 36 | + |
| 37 | +#endif |
| 38 | + |
| 39 | +#ifdef cl_khr_fp16 |
| 40 | + |
| 41 | +#pragma OPENCL EXTENSION cl_khr_fp16 : enable |
| 42 | + |
| 43 | +_CLC_DEF _CLC_OVERLOAD half __clc_fmax(half x, half y) { |
| 44 | + if (__clc_isnan(x)) |
| 45 | + return y; |
| 46 | + if (__clc_isnan(y)) |
| 47 | + return x; |
| 48 | + return (x < y) ? y : x; |
| 49 | +} |
| 50 | + |
| 51 | +#define __HALF_ONLY |
| 52 | +#define __CLC_SUPPORTED_VECSIZE_OR_1 2 |
| 53 | +#define FUNCTION __clc_fmax |
| 54 | +#define __CLC_BODY <clc/shared/binary_def_scalarize.inc> |
| 55 | +#include <clc/math/gentype.inc> |
| 56 | +#undef FUNCTION |
| 57 | + |
| 58 | +#endif |
0 commit comments