diff options
Diffstat (limited to 'libc/src')
-rw-r--r-- | libc/src/dlfcn/dladdr.cpp | 3 | ||||
-rw-r--r-- | libc/src/dlfcn/dladdr.h | 2 | ||||
-rw-r--r-- | libc/src/dlfcn/dlinfo.cpp | 3 | ||||
-rw-r--r-- | libc/src/dlfcn/dlinfo.h | 2 | ||||
-rw-r--r-- | libc/src/dlfcn/dlsym.cpp | 4 | ||||
-rw-r--r-- | libc/src/dlfcn/dlsym.h | 2 | ||||
-rw-r--r-- | libc/src/math/CMakeLists.txt | 5 | ||||
-rw-r--r-- | libc/src/math/ceilbf16.h | 21 | ||||
-rw-r--r-- | libc/src/math/floorbf16.h | 21 | ||||
-rw-r--r-- | libc/src/math/generic/CMakeLists.txt | 80 | ||||
-rw-r--r-- | libc/src/math/generic/ceilbf16.cpp | 19 | ||||
-rw-r--r-- | libc/src/math/generic/floorbf16.cpp | 21 | ||||
-rw-r--r-- | libc/src/math/generic/roundbf16.cpp | 21 | ||||
-rw-r--r-- | libc/src/math/generic/roundevenbf16.cpp | 21 | ||||
-rw-r--r-- | libc/src/math/generic/truncbf16.cpp | 21 | ||||
-rw-r--r-- | libc/src/math/roundbf16.h | 22 | ||||
-rw-r--r-- | libc/src/math/roundevenbf16.h | 21 | ||||
-rw-r--r-- | libc/src/math/truncbf16.h | 21 |
18 files changed, 304 insertions, 6 deletions
diff --git a/libc/src/dlfcn/dladdr.cpp b/libc/src/dlfcn/dladdr.cpp index 61490fd..3db68b4 100644 --- a/libc/src/dlfcn/dladdr.cpp +++ b/libc/src/dlfcn/dladdr.cpp @@ -14,7 +14,8 @@ namespace LIBC_NAMESPACE_DECL { // TODO: https:// github.com/llvm/llvm-project/issues/97929 -LLVM_LIBC_FUNCTION(int, dladdr, (const void *addr, Dl_info *info)) { +LLVM_LIBC_FUNCTION(int, dladdr, + (const void *__restrict addr, Dl_info *__restrict info)) { return -1; } diff --git a/libc/src/dlfcn/dladdr.h b/libc/src/dlfcn/dladdr.h index 346fc8d..abbc9a9 100644 --- a/libc/src/dlfcn/dladdr.h +++ b/libc/src/dlfcn/dladdr.h @@ -13,7 +13,7 @@ namespace LIBC_NAMESPACE_DECL { -int dladdr(const void *, Dl_info *); +int dladdr(const void *__restrict, Dl_info *__restrict); } // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/dlfcn/dlinfo.cpp b/libc/src/dlfcn/dlinfo.cpp index d78cade..e1938d1 100644 --- a/libc/src/dlfcn/dlinfo.cpp +++ b/libc/src/dlfcn/dlinfo.cpp @@ -16,7 +16,8 @@ namespace LIBC_NAMESPACE_DECL { // TODO: https://github.com/llvm/llvm-project/issues/149911 LLVM_LIBC_FUNCTION(int, dlinfo, - (void *restrict handle, int request, void *restrict info)) { + (void *__restrict handle, int request, + void *__restrict info)) { return -1; } diff --git a/libc/src/dlfcn/dlinfo.h b/libc/src/dlfcn/dlinfo.h index c2c34f0..bc13152 100644 --- a/libc/src/dlfcn/dlinfo.h +++ b/libc/src/dlfcn/dlinfo.h @@ -13,7 +13,7 @@ namespace LIBC_NAMESPACE_DECL { -int dlinfo(void *restrict, int, void *restrict); +int dlinfo(void *__restrict, int, void *__restrict); } // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/dlfcn/dlsym.cpp b/libc/src/dlfcn/dlsym.cpp index c075c20..dc0da7d 100644 --- a/libc/src/dlfcn/dlsym.cpp +++ b/libc/src/dlfcn/dlsym.cpp @@ -14,6 +14,8 @@ namespace LIBC_NAMESPACE_DECL { // TODO(@izaakschroeder): https://github.com/llvm/llvm-project/issues/97920 -LLVM_LIBC_FUNCTION(void *, dlsym, (void *, const char *)) { return nullptr; } +LLVM_LIBC_FUNCTION(void *, dlsym, (void *__restrict, const char *__restrict)) { + return nullptr; +} } // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/dlfcn/dlsym.h b/libc/src/dlfcn/dlsym.h index 70c6ab3..f879792 100644 --- a/libc/src/dlfcn/dlsym.h +++ b/libc/src/dlfcn/dlsym.h @@ -13,7 +13,7 @@ namespace LIBC_NAMESPACE_DECL { -void *dlsym(void *, const char *); +void *dlsym(void *__restrict, const char *__restrict); } // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt index 0522e0e..c3840d3 100644 --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -91,6 +91,7 @@ add_math_entrypoint_object(ceilf) add_math_entrypoint_object(ceill) add_math_entrypoint_object(ceilf16) add_math_entrypoint_object(ceilf128) +add_math_entrypoint_object(ceilbf16) add_math_entrypoint_object(copysign) add_math_entrypoint_object(copysignf) @@ -214,6 +215,7 @@ add_math_entrypoint_object(floorf) add_math_entrypoint_object(floorl) add_math_entrypoint_object(floorf16) add_math_entrypoint_object(floorf128) +add_math_entrypoint_object(floorbf16) add_math_entrypoint_object(fma) add_math_entrypoint_object(fmaf) @@ -463,12 +465,14 @@ add_math_entrypoint_object(roundf) add_math_entrypoint_object(roundl) add_math_entrypoint_object(roundf16) add_math_entrypoint_object(roundf128) +add_math_entrypoint_object(roundbf16) add_math_entrypoint_object(roundeven) add_math_entrypoint_object(roundevenf) add_math_entrypoint_object(roundevenl) add_math_entrypoint_object(roundevenf16) add_math_entrypoint_object(roundevenf128) +add_math_entrypoint_object(roundevenbf16) add_math_entrypoint_object(scalbln) add_math_entrypoint_object(scalblnf) @@ -546,6 +550,7 @@ add_math_entrypoint_object(truncf) add_math_entrypoint_object(truncl) add_math_entrypoint_object(truncf16) add_math_entrypoint_object(truncf128) +add_math_entrypoint_object(truncbf16) add_math_entrypoint_object(ufromfp) add_math_entrypoint_object(ufromfpf) diff --git a/libc/src/math/ceilbf16.h b/libc/src/math/ceilbf16.h new file mode 100644 index 0000000..bf70f25 --- /dev/null +++ b/libc/src/math/ceilbf16.h @@ -0,0 +1,21 @@ +//===-- Implementation header for ceilbf16 ----------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_CEILBF16_H +#define LLVM_LIBC_SRC_MATH_CEILBF16_H + +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE_DECL { + +bfloat16 ceilbf16(bfloat16 x); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_CEILBF16_H diff --git a/libc/src/math/floorbf16.h b/libc/src/math/floorbf16.h new file mode 100644 index 0000000..9b5a30a --- /dev/null +++ b/libc/src/math/floorbf16.h @@ -0,0 +1,21 @@ +//===-- Implementation header for floorbf16 ---------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_FLOORBF16_H +#define LLVM_LIBC_SRC_MATH_FLOORBF16_H + +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE_DECL { + +bfloat16 floorbf16(bfloat16 x); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_FLOORBF16_H diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index a866195..0bec7dd 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -157,6 +157,22 @@ add_entrypoint_object( ) add_entrypoint_object( + ceilbf16 + SRCS + ceilbf16.cpp + HDRS + ../ceilbf16.h + DEPENDS + libc.src.__support.common + libc.src.__support.FPUtil.bfloat16 + libc.src.__support.FPUtil.nearest_integer_operations + libc.src.__support.macros.config + libc.src.__support.macros.properties.types + FLAGS + ROUND_OPT +) + +add_entrypoint_object( daddl SRCS daddl.cpp @@ -802,6 +818,22 @@ add_entrypoint_object( ) add_entrypoint_object( + truncbf16 + SRCS + truncbf16.cpp + HDRS + ../truncbf16.h + DEPENDS + libc.src.__support.common + libc.src.__support.FPUtil.bfloat16 + libc.src.__support.FPUtil.nearest_integer_operations + libc.src.__support.macros.config + libc.src.__support.macros.properties.types + FLAGS + ROUND_OPT +) + +add_entrypoint_object( floor SRCS floor.cpp @@ -862,6 +894,22 @@ add_entrypoint_object( ) add_entrypoint_object( + floorbf16 + SRCS + floorbf16.cpp + HDRS + ../floorbf16.h + DEPENDS + libc.src.__support.common + libc.src.__support.FPUtil.bfloat16 + libc.src.__support.FPUtil.nearest_integer_operations + libc.src.__support.macros.config + libc.src.__support.macros.properties.types + FLAGS + ROUND_OPT +) + +add_entrypoint_object( round SRCS round.cpp @@ -922,6 +970,22 @@ add_entrypoint_object( ) add_entrypoint_object( + roundbf16 + SRCS + roundbf16.cpp + HDRS + ../roundbf16.h + DEPENDS + libc.src.__support.common + libc.src.__support.FPUtil.bfloat16 + libc.src.__support.FPUtil.nearest_integer_operations + libc.src.__support.macros.config + libc.src.__support.macros.properties.types + FLAGS + ROUND_OPT +) + +add_entrypoint_object( roundeven SRCS roundeven.cpp @@ -982,6 +1046,22 @@ add_entrypoint_object( ) add_entrypoint_object( + roundevenbf16 + SRCS + roundevenbf16.cpp + HDRS + ../roundevenbf16.h + DEPENDS + libc.src.__support.common + libc.src.__support.FPUtil.bfloat16 + libc.src.__support.FPUtil.nearest_integer_operations + libc.src.__support.macros.config + libc.src.__support.macros.properties.types + FLAGS + ROUND_OPT +) + +add_entrypoint_object( lround SRCS lround.cpp diff --git a/libc/src/math/generic/ceilbf16.cpp b/libc/src/math/generic/ceilbf16.cpp new file mode 100644 index 0000000..441dcf0 --- /dev/null +++ b/libc/src/math/generic/ceilbf16.cpp @@ -0,0 +1,19 @@ +//===-- Implementation of ceilbf16 function -------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "src/math/ceilbf16.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/FPUtil/bfloat16.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(bfloat16, ceilbf16, (bfloat16 x)) { return fputil::ceil(x); } + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/generic/floorbf16.cpp b/libc/src/math/generic/floorbf16.cpp new file mode 100644 index 0000000..d157096 --- /dev/null +++ b/libc/src/math/generic/floorbf16.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of floorbf16 function ------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "src/math/floorbf16.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/FPUtil/bfloat16.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(bfloat16, floorbf16, (bfloat16 x)) { + return fputil::floor(x); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/generic/roundbf16.cpp b/libc/src/math/generic/roundbf16.cpp new file mode 100644 index 0000000..cc7e5e2 --- /dev/null +++ b/libc/src/math/generic/roundbf16.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of roundbf16 function ------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "src/math/roundbf16.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/FPUtil/bfloat16.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(bfloat16, roundbf16, (bfloat16 x)) { + return fputil::round(x); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/generic/roundevenbf16.cpp b/libc/src/math/generic/roundevenbf16.cpp new file mode 100644 index 0000000..39419e4 --- /dev/null +++ b/libc/src/math/generic/roundevenbf16.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of roundevenbf16 function --------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "src/math/roundevenbf16.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/FPUtil/bfloat16.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(bfloat16, roundevenbf16, (bfloat16 x)) { + return fputil::round_using_specific_rounding_mode(x, FP_INT_TONEAREST); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/generic/truncbf16.cpp b/libc/src/math/generic/truncbf16.cpp new file mode 100644 index 0000000..dfbe83d --- /dev/null +++ b/libc/src/math/generic/truncbf16.cpp @@ -0,0 +1,21 @@ +//===-- Implementation of truncbf16 function ------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "src/math/truncbf16.h" +#include "src/__support/FPUtil/NearestIntegerOperations.h" +#include "src/__support/FPUtil/bfloat16.h" +#include "src/__support/common.h" +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { + +LLVM_LIBC_FUNCTION(bfloat16, truncbf16, (bfloat16 x)) { + return fputil::trunc(x); +} + +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/math/roundbf16.h b/libc/src/math/roundbf16.h new file mode 100644 index 0000000..0f74e43 --- /dev/null +++ b/libc/src/math/roundbf16.h @@ -0,0 +1,22 @@ +//===-- Implementation header for roundbf16 ---------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_ROUNDBF16_H +#define LLVM_LIBC_SRC_MATH_ROUNDBF16_H + +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE_DECL { + +bfloat16 roundbf16(bfloat16 x); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_ROUNDBF16_H diff --git a/libc/src/math/roundevenbf16.h b/libc/src/math/roundevenbf16.h new file mode 100644 index 0000000..f4374d2 --- /dev/null +++ b/libc/src/math/roundevenbf16.h @@ -0,0 +1,21 @@ +//===-- Implementation header for roundevenbf16 -----------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H +#define LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H + +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE_DECL { + +bfloat16 roundevenbf16(bfloat16 x); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_ROUNDEVENBF16_H diff --git a/libc/src/math/truncbf16.h b/libc/src/math/truncbf16.h new file mode 100644 index 0000000..c87d4cc --- /dev/null +++ b/libc/src/math/truncbf16.h @@ -0,0 +1,21 @@ +//===-- Implementation header for truncbf16 ---------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIBC_SRC_MATH_TRUNCBF16_H +#define LLVM_LIBC_SRC_MATH_TRUNCBF16_H + +#include "src/__support/macros/config.h" +#include "src/__support/macros/properties/types.h" + +namespace LIBC_NAMESPACE_DECL { + +bfloat16 truncbf16(bfloat16 x); + +} // namespace LIBC_NAMESPACE_DECL + +#endif // LLVM_LIBC_SRC_MATH_TRUNCBF16_H |