File tree Expand file tree Collapse file tree 4 files changed +63
-0
lines changed
Expand file tree Collapse file tree 4 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ add_math_entrypoint_object(nanf)
420420add_math_entrypoint_object(nanl)
421421add_math_entrypoint_object(nanf16)
422422add_math_entrypoint_object(nanf128)
423+ add_math_entrypoint_object(nanbf16)
423424
424425add_math_entrypoint_object(nearbyint)
425426add_math_entrypoint_object(nearbyintf)
Original file line number Diff line number Diff line change @@ -3444,6 +3444,22 @@ add_entrypoint_object(
34443444 libc.src.errno.errno
34453445)
34463446
3447+ add_entrypoint_object(
3448+ nanbf16
3449+ SRCS
3450+ nanbf16.cpp
3451+ HDRS
3452+ ../nanbf16.h
3453+ DEPENDS
3454+ libc.src.errno.errno
3455+ libc.src.__support.common
3456+ libc.src.__support.FPUtil.bfloat16
3457+ libc.src.__support.libc_errno
3458+ libc.src.__support.macros .config
3459+ libc.src.__support.macros .properties.types
3460+ libc.src.__support.str_to_float
3461+ )
3462+
34473463add_entrypoint_object(
34483464 nextafter
34493465 SRCS
Original file line number Diff line number Diff line change 1+ // ===-- Implementation of nanbf16 function --------------------------------===//
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 " src/math/nanbf16.h"
10+ #include " src/__support/FPUtil/bfloat16.h"
11+ #include " src/__support/common.h"
12+ #include " src/__support/libc_errno.h"
13+ #include " src/__support/macros/config.h"
14+ #include " src/__support/str_to_float.h"
15+
16+ namespace LIBC_NAMESPACE_DECL {
17+
18+ LLVM_LIBC_FUNCTION (bfloat16, nanbf16, (const char *arg)) {
19+ auto result = internal::strtonan<bfloat16>(arg);
20+ if (result.has_error ())
21+ libc_errno = result.error ;
22+ return result.value ;
23+ }
24+
25+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change 1+ // ===-- Implementation header for nanbf16 -----------------------*- C++ -*-===//
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+ #ifndef LLVM_LIBC_SRC_MATH_NANBF16_H
10+ #define LLVM_LIBC_SRC_MATH_NANBF16_H
11+
12+ #include " src/__support/macros/config.h"
13+ #include " src/__support/macros/properties/types.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ bfloat16 nanbf16 (const char *arg);
18+
19+ } // namespace LIBC_NAMESPACE_DECL
20+
21+ #endif // LLVM_LIBC_SRC_MATH_NANBF16_H
You can’t perform that action at this time.
0 commit comments