This commit bulk-updates the libclc license headers to the current Apache-2.0 WITH LLVM-exception license in situations where they were previously attributed to AMD - and occasionally under an additional single individual contributor - under an MIT license. AMD signed the LLVM relicensing agreement and so agreed for their past contributions under the new LLVM license. The LLVM project also has had a long-standing, unwritten, policy of not adding copyright notices to source code. This policy was recently written up [1]. This commit therefore also removes these copyright notices at the same time. Note that there are outstanding copyright notices attributed to others - and many files missing copyright headers - which will be dealt with in future work. [1] https://llvm.org/docs/DeveloperPolicy.html#embedded-copyright-or-contributed-by-statements
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#if __CLC_FPSIZE == 64
|
|
#define MIN_CONSTANT 0x1.fffffffffffffp-1
|
|
#define ZERO 0.0
|
|
#elif __CLC_FPSIZE == 32
|
|
#define MIN_CONSTANT 0x1.fffffep-1f
|
|
#define ZERO 0.0f
|
|
#elif __CLC_FPSIZE == 16
|
|
#define MIN_CONSTANT 0x1.ffcp-1h
|
|
#define ZERO 0.0h
|
|
#endif
|
|
|
|
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fract(__CLC_GENTYPE x, private __CLC_GENTYPE *iptr) {
|
|
*iptr = floor(x);
|
|
__CLC_GENTYPE r = fmin(x - *iptr, MIN_CONSTANT);
|
|
r = isinf(x) ? ZERO : r;
|
|
r = isnan(x) ? x : r;
|
|
return r;
|
|
}
|
|
|
|
|
|
#define FRACT_DEF(addrspace) \
|
|
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE fract(__CLC_GENTYPE x, addrspace __CLC_GENTYPE *iptr) { \
|
|
__CLC_GENTYPE private_iptr; \
|
|
__CLC_GENTYPE ret = fract(x, &private_iptr); \
|
|
*iptr = private_iptr; \
|
|
return ret; \
|
|
}
|
|
|
|
FRACT_DEF(local);
|
|
FRACT_DEF(global);
|
|
|
|
#undef MIN_CONSTANT
|
|
#undef ZERO
|