-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc][math][c23] Add dadd{l,f128} and ddiv{l,f128} C23 math functions #100456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libc Author: None (aaryanshukla) Changes
Patch is 29.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/100456.diff 35 Files Affected:
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6e0760724d963..45cca17562d26 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -73,7 +73,7 @@ if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
add_subdirectory(utils/gpu)
endif()
-option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" OFF)
+option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
set(NEED_LIBC_HDRGEN FALSE)
if(NOT LLVM_RUNTIMES_BUILD)
diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt
index 8025ac09b9f82..d9ba57ef0b9c5 100644
--- a/libc/config/baremetal/arm/entrypoints.txt
+++ b/libc/config/baremetal/arm/entrypoints.txt
@@ -247,6 +247,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cos
libc.src.math.cosf
libc.src.math.coshf
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.exp10
diff --git a/libc/config/baremetal/riscv/entrypoints.txt b/libc/config/baremetal/riscv/entrypoints.txt
index fb0308c953746..d1a54dc24e385 100644
--- a/libc/config/baremetal/riscv/entrypoints.txt
+++ b/libc/config/baremetal/riscv/entrypoints.txt
@@ -243,6 +243,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cos
libc.src.math.cosf
libc.src.math.coshf
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.exp10
diff --git a/libc/config/darwin/arm/entrypoints.txt b/libc/config/darwin/arm/entrypoints.txt
index ea5c7b537bbec..6c5e86f7dcafc 100644
--- a/libc/config/darwin/arm/entrypoints.txt
+++ b/libc/config/darwin/arm/entrypoints.txt
@@ -135,7 +135,15 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cos
libc.src.math.cosf
libc.src.math.cospif
+ libc.src.math.daddl
+ libc.src.math.daddf128
libc.src.math.dsqrtl
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.expf
diff --git a/libc/config/darwin/x86_64/entrypoints.txt b/libc/config/darwin/x86_64/entrypoints.txt
index 1a7353172d464..6e461c4828d42 100644
--- a/libc/config/darwin/x86_64/entrypoints.txt
+++ b/libc/config/darwin/x86_64/entrypoints.txt
@@ -119,7 +119,15 @@ set(TARGET_LIBM_ENTRYPOINTS
#libc.src.math.ceill
#libc.src.math.coshf
#libc.src.math.cosf
+ libc.src.math.daddl
+ libc.src.math.daddf128
#libc.src.math.dsqrtl
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
#libc.src.math.expf
#libc.src.math.exp2f
#libc.src.math.expm1f
diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 506c7d6d7b314..8c3dfa47cb2c1 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -254,6 +254,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosf
libc.src.math.cosh
libc.src.math.coshf
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erf
libc.src.math.erff
libc.src.math.exp
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 0be6f884f0368..f0d6981bca02a 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -358,6 +358,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosf
libc.src.math.coshf
libc.src.math.cospif
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.dmull
libc.src.math.dsqrtl
libc.src.math.erff
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 55f118395c22e..13992055d7074 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -227,7 +227,15 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cos
libc.src.math.cosf
libc.src.math.coshf
+ libc.src.math.daddl
+ libc.src.math.daddf128
libc.src.math.dsqrtl
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.exp10
diff --git a/libc/config/linux/riscv/entrypoints.txt b/libc/config/linux/riscv/entrypoints.txt
index ea08957f4ee89..bc142e7d46523 100644
--- a/libc/config/linux/riscv/entrypoints.txt
+++ b/libc/config/linux/riscv/entrypoints.txt
@@ -381,8 +381,16 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cosf
libc.src.math.coshf
libc.src.math.cospif
+ libc.src.math.daddl
+ libc.src.math.daddf128
libc.src.math.dmull
libc.src.math.dsqrtl
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.exp10
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 7c422bad9f01d..5fe9e7d19606b 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -383,6 +383,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cospif
libc.src.math.dmull
libc.src.math.dsqrtl
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.exp10
diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt
index b6aced83c5815..72b665cdf3932 100644
--- a/libc/config/windows/entrypoints.txt
+++ b/libc/config/windows/entrypoints.txt
@@ -132,6 +132,10 @@ set(TARGET_LIBM_ENTRYPOINTS
libc.src.math.cos
libc.src.math.cosf
libc.src.math.coshf
+ libc.src.math.daddl
+ libc.src.math.daddf128
+ libc.src.math.ddivl
+ libc.src.math.ddivf128
libc.src.math.erff
libc.src.math.exp
libc.src.math.expf
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index f287c16fd01e2..f8b18e11c8aac 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -114,10 +114,10 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| copysign | |check| | |check| | |check| | |check| | |check| | 7.12.11.1 | F.10.8.1 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| dadd | N/A | N/A | | N/A | | 7.12.14.1 | F.10.11 |
-+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| ddiv | N/A | N/A | | N/A | | 7.12.14.4 | F.10.11 |
+| dadd | N/A | N/A | |check| | N/A | |check| | 7.12.14.1 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
+| ddiv | N/A | N/A | |check| | N/A | |check| | 7.12.14.4 | F.10.11 |
++------------------+------------------+-----------------+------------------------+----------------------+- -----------------------+------------------------+----------------------------+
| dfma | N/A | N/A | | N/A | | 7.12.14.5 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| dmul | N/A | N/A | |check| | N/A | |check|\* | 7.12.14.3 | F.10.11 |
@@ -136,7 +136,7 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| fabs | |check| | |check| | |check| | |check| | |check| | 7.12.7.3 | F.10.4.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
-| fadd | N/A | |check| | |check| | N/A | |check| | 7.12.14.1 | F.10.11 |
+| fadd | N/A | | | N/A | | 7.12.14.1 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| fdim | |check| | |check| | |check| | |check| | |check| | 7.12.12.1 | F.10.9.1 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 78588055cc960..29a8ff5eef05d 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -118,7 +118,7 @@ def load_yaml_file(yaml_file, header_class, entry_points):
HeaderFile: An instance of HeaderFile populated with the data.
"""
with open(yaml_file, "r") as f:
- yaml_data = yaml.safe_load(f)
+ yaml_data = yaml.load(f, Loader=yaml.FullLoader)
return yaml_to_classes(yaml_data, header_class, entry_points)
@@ -173,7 +173,7 @@ def add_function_to_yaml(yaml_file, function_details):
new_function = parse_function_details(function_details)
with open(yaml_file, "r") as f:
- yaml_data = yaml.safe_load(f)
+ yaml_data = yaml.load(f, Loader=yaml.FullLoader)
if "functions" not in yaml_data:
yaml_data["functions"] = []
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index 0aae65308d33a..55ec2f96ecdf5 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -397,6 +397,11 @@ def StdC : StandardSpec<"stdc"> {
GuardedFunctionSpec<"ceilf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
+ FunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
+ FunctionSpec<"daddl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+ FunctionSpec<"ddivl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
+ FunctionSpec<"ddivf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>]>,
+
FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 25aef3f72e3cd..5688c3590c18d 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -86,6 +86,10 @@ add_math_entrypoint_object(cosh)
add_math_entrypoint_object(coshf)
add_math_entrypoint_object(cospif)
+add_math_entrypoint_object(daddl)
+add_math_entrypoint_object(daddf128)
+add_math_entrypoint_object(ddivl)
+add_math_entrypoint_object(ddivf128)
add_math_entrypoint_object(dmull)
add_math_entrypoint_object(dmulf128)
diff --git a/libc/src/math/daddf128.h b/libc/src/math/daddf128.h
new file mode 100644
index 0000000000000..2ad261d525337
--- /dev/null
+++ b/libc/src/math/daddf128.h
@@ -0,0 +1,22 @@
+//===-- Implementation header for daddf128 --------------------------*- 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_DADDF128_H
+#define LLVM_LIBC_SRC_MATH_DADDF128_H
+
+#include "include/llvm-libc-types/float128.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double daddf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DADDF128_H
diff --git a/libc/src/math/daddl.h b/libc/src/math/daddl.h
new file mode 100644
index 0000000000000..1b3bdeeb04894
--- /dev/null
+++ b/libc/src/math/daddl.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for daddl --------------------------*- 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_DADDL_H
+#define LLVM_LIBC_SRC_MATH_DADDL_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double daddl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DADDL_H
diff --git a/libc/src/math/ddivf128.h b/libc/src/math/ddivf128.h
new file mode 100644
index 0000000000000..a32d2349f8952
--- /dev/null
+++ b/libc/src/math/ddivf128.h
@@ -0,0 +1,21 @@
+//===-- Implementation header for ddivf128 ----------------------*- 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_DDIVF128_H
+#define LLVM_LIBC_SRC_MATH_DDIVF128_H
+
+#include "include/llvm-libc-types/float128.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double ddivf128(float128 x, float128 y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DDIVF128_H
diff --git a/libc/src/math/ddivl.h b/libc/src/math/ddivl.h
new file mode 100644
index 0000000000000..bf0da2887e330
--- /dev/null
+++ b/libc/src/math/ddivl.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for ddivl -------------------------*- 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_DDIVL_H
+#define LLVM_LIBC_SRC_MATH_DDIVL_H
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+double ddivl(long double x, long double y);
+
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC_MATH_DDIVL_H
diff --git a/libc/src/math/fadd.h b/libc/src/math/fadd.h
index ec3ce18bb676a..1186f1ef40954 100644
--- a/libc/src/math/fadd.h
+++ b/libc/src/math/fadd.h
@@ -6,11 +6,10 @@
//
//===----------------------------------------------------------------------===//
-#include "src/__support/macros/config.h"
-
#ifndef LLVM_LIBC_SRC_MATH_FADD_H
#define LLVM_LIBC_SRC_MATH_FADD_H
+#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
float fadd(double x, double y);
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 74360edff3f9a..61aa76a331c84 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -129,6 +129,58 @@ add_entrypoint_object(
libc.src.__support.FPUtil.nearest_integer_operations
)
+add_entrypoint_object(
+ daddl
+ SRCS
+ daddl.cpp
+ HDRS
+ ../daddl.h
+ COMPILE_OPTIONS
+ -O3
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.add_sub
+
+)
+
+add_entrypoint_object(
+ daddf128
+ SRCS
+ daddf128.cpp
+ HDRS
+ ../daddf128.h
+ COMPILE_OPTIONS
+ -O3
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.add_sub
+)
+
+add_entrypoint_object(
+ ddivl
+ SRCS
+ ddivl.cpp
+ HDRS
+ ../ddivl.h
+ COMPILE_OPTIONS
+ -O3
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.div
+)
+
+add_entrypoint_object(
+ ddivf128
+ SRCS
+ ddivf128.cpp
+ HDRS
+ ../ddivf128.h
+ COMPILE_OPTIONS
+ -O3
+ DEPENDS
+ libc.src.__support.FPUtil.generic.div
+)
+
add_entrypoint_object(
dsqrtl
SRCS
@@ -492,7 +544,7 @@ add_entrypoint_object(
HDRS
../fadd.h
DEPENDS
- libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.generic.add_sub
COMPILE_OPTIONS
-O3
)
diff --git a/libc/src/math/generic/daddf128.cpp b/libc/src/math/generic/daddf128.cpp
new file mode 100644
index 0000000000000..b967689ec9e81
--- /dev/null
+++ b/libc/src/math/generic/daddf128.cpp
@@ -0,0 +1,22 @@
+//===-- Implementation of daddf128 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/daddf128.h"
+#include "include/llvm-libc-types/float128.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, daddf128, (float128 x, float128 y)) {
+ return fputil::generic::add<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/daddl.cpp b/libc/src/math/generic/daddl.cpp
new file mode 100644
index 0000000000000..2ae1add239162
--- /dev/null
+++ b/libc/src/math/generic/daddl.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of daddl 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/daddl.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, daddl, (long double x, long double y)) {
+ return fputil::generic::add<double>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/generic/ddivf128.cpp b/libc/src/math/generic/ddivf12...
[truncated]
|
I had made a Python script to generate some of the boilerplate for math functions, but it's not yet updated for the move to https://github.com/overmighty/llvm-dev-utils/blob/master/llvm_libc_add_math_function.py |
I've changed the PR title to better reflect the fact that it adds multiple variants of Be careful of what you set the PR description to, as GitHub will suggest that as default extended commit description when merging. |
libc/newhdrgen/yaml_to_classes.py
Outdated
@@ -174,6 +174,7 @@ def add_function_to_yaml(yaml_file, function_details): | |||
|
|||
with open(yaml_file, "r") as f: | |||
yaml_data = yaml.load(f, Loader=yaml.FullLoader) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just remove this new line so that this PR doesn't change newhdrgen at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just this last request and it LGTM. You can add the fadd
docs change back if you want, since Tue approves of it. I forgot that we sometimes also change some COMPILE_OPTIONS -O2
to -O3
when changing/adding functions nearby.
@overmighty I see that the build failed not due to my changes. Am I still good to merge? |
libc/test/src/math/ddivl_test.cpp
Outdated
|
||
#include "src/math/ddivl.h" | ||
|
||
LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::ddivl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You wrote LIST_ADD_TESTS
instead of LIST_DIV_TESTS
, so the preprocessor didn't replace the macro, and Clang thought you were declaring a function and that LIBC_NAMESPACE::ddivl
was meant to be the type of an unnamed function parameter.
The log view on the Buildkite website only displays the last 2 MB of data. You can view the error messages if you download the raw log:
Relevant part of the Buildkite log
�_bk;t=1722365638958�
[2610/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxf_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmaxf_test.cpp.o�[K�_bk;t=1722365638959�
[2611/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ldexpl_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638959�
[2611/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxf_test.__unit__.__NO_FMA_OPT.__build__.dir/fmaxf_test.cpp.o�[K�_bk;t=1722365638959�
[2612/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogbl_test.__unit__.__build__�[K�_bk;t=1722365638959�
[2612/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxf_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmaxf_test.cpp.o�[K�_bk;t=1722365638962�
[2613/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ldexp_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638962�
[2613/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638963�
[2614/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ldexpf_test.__unit__.__build__�[K�_bk;t=1722365638963�
[2614/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638963�
[2615/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.copysignf_test.__unit__.__build__�[K�_bk;t=1722365638964�
[2615/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638964�
[2616/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.copysignf_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638964�
[2616/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638964�
[2617/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.frexpl_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638964�
[2617/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxl_test.__unit__.__build__.dir/fmaxl_test.cpp.o�[K�_bk;t=1722365638965�
[2618/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogbf_test.__unit__.__build__�[K�_bk;t=1722365638965�
[2618/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxl_test.__unit__.__NO_FMA_OPT.__build__.dir/fmaxl_test.cpp.o�[K�_bk;t=1722365638966�
[2619/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmin_test.__unit__.__NO_FMA_OPT.__build__.dir/fmin_test.cpp.o�[K�_bk;t=1722365638966�
[2619/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmin_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638967�
[2620/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmin_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmin_test.cpp.o�[K�_bk;t=1722365638967�
[2620/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmin_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638967�
[2621/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.frexpf_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638967�
[2621/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.sqrtf_test.__unit__.__build__.dir/sqrtf_test.cpp.o�[K�_bk;t=1722365638968�
[2622/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogbf_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638968�
[2622/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.sqrt_test.__unit__.__build__.dir/sqrt_test.cpp.o�[K�_bk;t=1722365638968�
[2623/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogbl_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638968�
[2623/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.sqrtl_test.__unit__.__build__.dir/sqrtl_test.cpp.o�[K�_bk;t=1722365638973�
[2624/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fminl_test.__unit__.__NO_FMA_OPT.__build__.dir/fminl_test.cpp.o�[K�_bk;t=1722365638973�
[2624/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fminl_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638978�
[2625/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ldexp_test.__unit__.__build__�[K�_bk;t=1722365638978�
[2625/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.generic_sqrtf_test.__unit__.__build__.dir/generic_sqrtf_test.cpp.o�[K�_bk;t=1722365638979�
[2626/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmin_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmin_test.cpp.o�[K�_bk;t=1722365638979�
[2626/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmin_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638980�
[2627/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogb_test.__unit__.__build__�[K�_bk;t=1722365638980�
[2627/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.generic_sqrtf_test.__unit__.__NO_FMA_OPT.__build__.dir/generic_sqrtf_test.cpp.o�[K�_bk;t=1722365638986�
[2628/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmin_test.__unit__.__build__.dir/fmin_test.cpp.o�[K�_bk;t=1722365638986�
[2628/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmin_test.__unit__.__build__�[K�_bk;t=1722365638987�
[2629/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.ilogb_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638987�
[2629/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.generic_sqrt_test.__unit__.__build__.dir/generic_sqrt_test.cpp.o�[K�_bk;t=1722365638989�
[2630/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.logb_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638989�
[2630/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.generic_sqrt_test.__unit__.__NO_FMA_OPT.__build__.dir/generic_sqrt_test.cpp.o�[K�_bk;t=1722365638990�
[2631/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fminl_test.__unit__.__build__.dir/fminl_test.cpp.o�[K�_bk;t=1722365638990�
[2631/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fminl_test.__unit__.__build__�[K�_bk;t=1722365638992�
[2632/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxf_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmaxf_test.cpp.o�[K�_bk;t=1722365638992�
[2632/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmaxf_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638993�
[2633/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxf_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmaxf_test.cpp.o�[K�_bk;t=1722365638993�
[2633/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmaxf_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638994�
[2634/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638995�
[2634/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmax_test.__unit__.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365638996�
[2635/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638997�
[2635/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__build__�[K�_bk;t=1722365638999�
[2636/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__.dir/fmax_test.cpp.o�[K�_bk;t=1722365638999�
[2636/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmax_test.__unit__.__NO_FMA_OPT.__NO_MISC_MATH_BASIC_OPS_OPT.__build__�[K�_bk;t=1722365639000�
[2637/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.fmaxl_test.__unit__.__build__.dir/fmaxl_test.cpp.o�[K�_bk;t=1722365639000�
[2637/6331] Linking CXX executable projects/libc/test/src/math/libc.test.src.math.fmaxl_test.__unit__.__build__�[K�_bk;t=1722365639002�
[2638/6331] Building CXX object projects/libc/test/src/math/CMakeFiles/libc.test.src.math.ddivl_test.__unit__.__build__.dir/ddivl_test.cpp.o�[K�_bk;t=1722365639002�
�_bk;t=1722365639002��[31mFAILED: �[0mprojects/libc/test/src/math/CMakeFiles/libc.test.src.math.ddivl_test.__unit__.__build__.dir/ddivl_test.cpp.o
�_bk;t=1722365639002�CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/build/projects/libc/test/src/math -I/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/libc/test/src/math -I/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/libc -isystem /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/build/projects/libc/include -gmlt -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -mavx2 -mfma -fpie -march=native -fno-exceptions -fno-rtti -std=c++17 -MD -MT projects/libc/test/src/math/CMakeFiles/libc.test.src.math.ddivl_test.__unit__.__build__.dir/ddivl_test.cpp.o -MF projects/libc/test/src/math/CMakeFiles/libc.test.src.math.ddivl_test.__unit__.__build__.dir/ddivl_test.cpp.o.d -o projects/libc/test/src/math/CMakeFiles/libc.test.src.math.ddivl_test.__unit__.__build__.dir/ddivl_test.cpp.o -c /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/libc/test/src/math/ddivl_test.cpp
�_bk;t=1722365639003��[1m/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/libc/test/src/math/ddivl_test.cpp:13:53: �[0m�[0;1;31merror: �[0m�[1mno type named 'ddivl' in namespace '__llvm_libc_20_0_0_git'�[0m
�_bk;t=1722365639003�LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::ddivl)
�_bk;t=1722365639003��[0;1;32m ~~~~~~~~~~~~~~~~^
�_bk;t=1722365639003��[0m�[1m/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-xmlqb-1/llvm-project/github-pull-requests/libc/test/src/math/ddivl_test.cpp:13:59: �[0m�[0;1;31merror: �[0m�[1mexpected function body after function declarator�[0m
�_bk;t=1722365639003�LIST_ADD_TESTS(double, long double, LIBC_NAMESPACE::ddivl)
�_bk;t=1722365639003��[0;1;32m ^
�_bk;t=1722365639003��[0m2 errors generated.
By the way, I tried to change it to LIST_DIV_TESTS
and then the MPFR test failed due to incorrect results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed + it passes for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you on an x86-64 or AArch64 machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
X86-64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I'll wait for the CI results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should see a warning message saying "Math tests using MPFR will be skipped" in the CMake configuration output by the way. You can apply this patch and check the CMake configuration output to try to debug the issue:
diff --git a/libc/cmake/modules/LLVMLibCCheckMPFR.cmake b/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
index a27c2dc0c030..3672d25d1378 100644
--- a/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
+++ b/libc/cmake/modules/LLVMLibCCheckMPFR.cmake
@@ -14,5 +14,7 @@ else()
${LIBC_SOURCE_DIR}/utils/MPFRWrapper/check_mpfr.cpp
LINK_LIBRARIES
-lmpfr -lgmp -latomic
+ OUTPUT_VARIABLE foo
)
+ message(WARNING ${foo})
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I see the math tests using MPFR will be skipped, I need to install MPFR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI build passed after you removed ddivl
so you can merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there documentation for installing mpfr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of any. If you're on Linux then you should search your Linux distribution's package repositories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that the docs weren't updated after the removal of ddivl
.
Co-authored-by: OverMighty <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.