diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt --- a/libc/src/math/CMakeLists.txt +++ b/libc/src/math/CMakeLists.txt @@ -1,180 +1,464 @@ -add_subdirectory(generic) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_ARCHITECTURE}) - add_subdirectory(${LIBC_TARGET_ARCHITECTURE}) -endif() - -function(add_math_entrypoint_object name) - # We prefer machine specific implementation if available. Hence we check - # that first and return early if we are able to add an alias target for the - # machine specific implementation. - get_fq_target_name("${LIBC_TARGET_ARCHITECTURE}.${name}" fq_machine_specific_target_name) - if(TARGET ${fq_machine_specific_target_name}) - add_entrypoint_object( - ${name} - ALIAS - DEPENDS - .${LIBC_TARGET_ARCHITECTURE}.${name} - ) - return() - endif() - - get_fq_target_name("generic.${name}" fq_generic_target_name) - if(TARGET ${fq_generic_target_name}) - add_entrypoint_object( - ${name} - ALIAS - DEPENDS - .generic.${name} - ) - return() - endif() - - # Add a dummy entrypoint object for missing implementations. They will be skipped - # anyway as there will be no entry for them in the target entrypoints list. - add_entrypoint_object( - ${name} - SRCS - dummy_srcs - HDRS - dummy_hdrs - ) -endfunction() +add_subdirectory(internal) add_entrypoint_object( fmaf - SRCS - fmaf.cpp - HDRS - fmaf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 + SRCS fmaf.cpp + HDRS fmaf.h + DEPENDS libc.src.__support.FPUtil.fputil + COMPILE_OPTIONS -O2 ) add_entrypoint_object( fma - SRCS - fma.cpp - HDRS - fma.h + SRCS fma.cpp + HDRS fma.h + DEPENDS libc.src.__support.FPUtil.fputil + COMPILE_OPTIONS -O2 +) + +function(add_math_entrypoint_object name) +cmake_parse_arguments( + "MATH_IMPL" + "" # Optional arguments + "" # Single value arguments + "DEPENDS;COMPILE_OPTIONS" # Multi value arguments + ${ARGN}) +add_entrypoint_object( + ${name} + SRCS ${name}.cpp + HDRS ${name}.h + DEPENDS ${MATH_IMPL_DEPENDS} + COMPILE_OPTIONS -O3 ${MATH_IMPL_COMPILE_OPTIONS} +) +endfunction() + +add_math_entrypoint_object( + ceil + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + ceilf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + ceill + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + cos +) + +add_math_entrypoint_object( + cosf DEPENDS + libc.include.math + libc.src.errno.__errno_location + libc.src.math.internal.sincosf_utils +) + +add_math_entrypoint_object( + sin +) + +add_math_entrypoint_object( + sinf + DEPENDS + libc.include.math libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 + libc.src.errno.__errno_location + libc.src.math.internal.sincosf_utils + COMPILE_OPTIONS -O3 +) + +add_math_entrypoint_object( + sincosf + DEPENDS + libc.include.math + libc.src.errno.__errno_location + libc.src.math.internal.sincosf_utils +) + +add_math_entrypoint_object( + fabs + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + fabsf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + fabsl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + trunc + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + truncf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + truncl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + floor + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + floorf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + floorl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + round + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + roundf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + roundl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + lround + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + lroundf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + lroundl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llround + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llroundf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llroundl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + rint + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + rintf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + rintl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + lrint + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + lrintf + DEPENDS libc.src.__support.FPUtil.fputil ) -add_math_entrypoint_object(ceil) -add_math_entrypoint_object(ceilf) -add_math_entrypoint_object(ceill) +add_math_entrypoint_object( + lrintl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llrint + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llrintf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + llrintl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + nearbyint + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + nearbyintf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + nearbyintl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + expf + DEPENDS + libc.src.math.internal.exp_utils + libc.src.math.internal.math_utils + libc.include.math +) + +add_math_entrypoint_object( + exp2f + DEPENDS + libc.src.math.internal.exp_utils + libc.src.math.internal.math_utils + libc.include.math +) + +add_math_entrypoint_object( + expm1f + DEPENDS libc.include.math + libc.src.math.expf + libc.src.math.fabsf +) + +add_math_entrypoint_object( + copysign + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + copysignf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + copysignl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + frexp + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + frexpf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + frexpl + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + ilogb + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + ilogbf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(copysign) -add_math_entrypoint_object(copysignf) -add_math_entrypoint_object(copysignl) +add_math_entrypoint_object( + ilogbl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(cos) -add_math_entrypoint_object(cosf) +add_math_entrypoint_object( + ldexp + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(expf) +add_math_entrypoint_object( + ldexpf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(exp2f) +add_math_entrypoint_object( + ldexpl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(expm1f) +add_math_entrypoint_object( + logb + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(fabs) -add_math_entrypoint_object(fabsf) -add_math_entrypoint_object(fabsl) +add_math_entrypoint_object( + logbf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(fdim) -add_math_entrypoint_object(fdimf) -add_math_entrypoint_object(fdiml) +add_math_entrypoint_object( + logbl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(floor) -add_math_entrypoint_object(floorf) -add_math_entrypoint_object(floorl) +add_math_entrypoint_object( + modf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(fmax) -add_math_entrypoint_object(fmaxf) -add_math_entrypoint_object(fmaxl) +add_math_entrypoint_object( + modff + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(fmin) -add_math_entrypoint_object(fminf) -add_math_entrypoint_object(fminl) +add_math_entrypoint_object( + modfl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(frexp) -add_math_entrypoint_object(frexpf) -add_math_entrypoint_object(frexpl) +add_math_entrypoint_object( + fmin + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(hypot) -add_math_entrypoint_object(hypotf) +add_math_entrypoint_object( + fminf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(ilogb) -add_math_entrypoint_object(ilogbf) -add_math_entrypoint_object(ilogbl) +add_math_entrypoint_object( + fminl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(ldexp) -add_math_entrypoint_object(ldexpf) -add_math_entrypoint_object(ldexpl) +add_math_entrypoint_object( + fmax + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(logb) -add_math_entrypoint_object(logbf) -add_math_entrypoint_object(logbl) +add_math_entrypoint_object( + fmaxf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(llrint) -add_math_entrypoint_object(llrintf) -add_math_entrypoint_object(llrintl) +add_math_entrypoint_object( + fmaxl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(llround) -add_math_entrypoint_object(llroundf) -add_math_entrypoint_object(llroundl) +add_math_entrypoint_object( + sqrt + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(lrint) -add_math_entrypoint_object(lrintf) -add_math_entrypoint_object(lrintl) +add_math_entrypoint_object( + tan +) -add_math_entrypoint_object(lround) -add_math_entrypoint_object(lroundf) -add_math_entrypoint_object(lroundl) +add_math_entrypoint_object( + sqrtf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(modf) -add_math_entrypoint_object(modff) -add_math_entrypoint_object(modfl) +add_math_entrypoint_object( + sqrtl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(nearbyint) -add_math_entrypoint_object(nearbyintf) -add_math_entrypoint_object(nearbyintl) +add_math_entrypoint_object( + remquof + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(nextafter) -add_math_entrypoint_object(nextafterf) -add_math_entrypoint_object(nextafterl) +add_math_entrypoint_object( + remquo + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + remquol + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + remainderf + DEPENDS libc.src.__support.FPUtil.fputil +) + +add_math_entrypoint_object( + remainder + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(remainder) -add_math_entrypoint_object(remainderf) -add_math_entrypoint_object(remainderl) +add_math_entrypoint_object( + remainderl + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(remquo) -add_math_entrypoint_object(remquof) -add_math_entrypoint_object(remquol) +add_math_entrypoint_object( + hypotf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(rint) -add_math_entrypoint_object(rintf) -add_math_entrypoint_object(rintl) +add_math_entrypoint_object( + fdim + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(round) -add_math_entrypoint_object(roundf) -add_math_entrypoint_object(roundl) +add_math_entrypoint_object( + fdimf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(sincosf) +add_math_entrypoint_object( + fdiml + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(sin) -add_math_entrypoint_object(sinf) +add_math_entrypoint_object( + hypot + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(sqrt) -add_math_entrypoint_object(sqrtf) -add_math_entrypoint_object(sqrtl) +add_math_entrypoint_object( + nextafter + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(tan) +add_math_entrypoint_object( + nextafterf + DEPENDS libc.src.__support.FPUtil.fputil +) -add_math_entrypoint_object(trunc) -add_math_entrypoint_object(truncf) -add_math_entrypoint_object(truncl) +add_math_entrypoint_object( + nextafterl + DEPENDS libc.src.__support.FPUtil.fputil +) diff --git a/libc/src/math/aarch64/CMakeLists.txt b/libc/src/math/aarch64/CMakeLists.txt deleted file mode 100644 --- a/libc/src/math/aarch64/CMakeLists.txt +++ /dev/null @@ -1,99 +0,0 @@ -add_entrypoint_object( - ceil - SRCS - ceil.cpp - HDRS - ../ceil.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ceilf - SRCS - ceilf.cpp - HDRS - ../ceilf.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - floor - SRCS - floor.cpp - HDRS - ../floor.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - floorf - SRCS - floorf.cpp - HDRS - ../floorf.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - trunc - SRCS - trunc.cpp - HDRS - ../trunc.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - truncf - SRCS - truncf.cpp - HDRS - ../truncf.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - round - SRCS - round.cpp - HDRS - ../round.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - roundf - SRCS - roundf.cpp - HDRS - ../roundf.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrt - SRCS - sqrt.cpp - HDRS - ../sqrt.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrtf - SRCS - sqrtf.cpp - HDRS - ../sqrtf.h - COMPILE_OPTIONS - -O2 -) diff --git a/libc/src/math/generic/ceil.cpp b/libc/src/math/ceil.cpp rename from libc/src/math/generic/ceil.cpp rename to libc/src/math/ceil.cpp --- a/libc/src/math/generic/ceil.cpp +++ b/libc/src/math/ceil.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ceil.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/ceil.cpp" +#else +#include "ceil.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(double, ceil, (double x)) { return fputil::ceil(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/ceilf.cpp b/libc/src/math/ceilf.cpp rename from libc/src/math/generic/ceilf.cpp rename to libc/src/math/ceilf.cpp --- a/libc/src/math/generic/ceilf.cpp +++ b/libc/src/math/ceilf.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ceilf.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/ceilf.cpp" +#else +#include "ceilf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(float, ceilf, (float x)) { return fputil::ceil(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/ceill.cpp b/libc/src/math/ceill.cpp rename from libc/src/math/generic/ceill.cpp rename to libc/src/math/ceill.cpp --- a/libc/src/math/generic/ceill.cpp +++ b/libc/src/math/ceill.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ceill.h" +#include "ceill.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/copysign.cpp b/libc/src/math/copysign.cpp rename from libc/src/math/generic/copysign.cpp rename to libc/src/math/copysign.cpp --- a/libc/src/math/generic/copysign.cpp +++ b/libc/src/math/copysign.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/copysign.h" +#include "copysign.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/copysignf.cpp b/libc/src/math/copysignf.cpp rename from libc/src/math/generic/copysignf.cpp rename to libc/src/math/copysignf.cpp --- a/libc/src/math/generic/copysignf.cpp +++ b/libc/src/math/copysignf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/copysignf.h" +#include "copysignf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/copysignl.cpp b/libc/src/math/copysignl.cpp rename from libc/src/math/generic/copysignl.cpp rename to libc/src/math/copysignl.cpp --- a/libc/src/math/generic/copysignl.cpp +++ b/libc/src/math/copysignl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/copysignl.h" +#include "copysignl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/cos.cpp rename from libc/src/math/generic/sqrt.cpp rename to libc/src/math/cos.cpp --- a/libc/src/math/generic/sqrt.cpp +++ b/libc/src/math/cos.cpp @@ -1,4 +1,4 @@ -//===-- Implementation of sqrt function -----------------------------------===// +//===-- Implementation of the cos function --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,12 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrt.h" -#include "src/__support/FPUtil/Sqrt.h" -#include "src/__support/common.h" +#include "src/__support/architectures.h" -namespace __llvm_libc { - -LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); } - -} // namespace __llvm_libc +#if defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/cos.cpp" +#endif diff --git a/libc/src/math/generic/cosf.cpp b/libc/src/math/cosf.cpp rename from libc/src/math/generic/cosf.cpp rename to libc/src/math/cosf.cpp --- a/libc/src/math/generic/cosf.cpp +++ b/libc/src/math/cosf.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/math/cosf.h" -#include "math_utils.h" -#include "sincosf_utils.h" - +#include "cosf.h" +#include "internal/math_utils.h" +#include "internal/sincosf_utils.h" #include "src/__support/common.h" #include diff --git a/libc/src/math/generic/exp2f.cpp b/libc/src/math/exp2f.cpp rename from libc/src/math/generic/exp2f.cpp rename to libc/src/math/exp2f.cpp --- a/libc/src/math/generic/exp2f.cpp +++ b/libc/src/math/exp2f.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/math/exp2f.h" -#include "exp_utils.h" -#include "math_utils.h" - +#include "exp2f.h" +#include "internal/exp_utils.h" +#include "internal/math_utils.h" #include "src/__support/common.h" #include diff --git a/libc/src/math/generic/expf.cpp b/libc/src/math/expf.cpp rename from libc/src/math/generic/expf.cpp rename to libc/src/math/expf.cpp --- a/libc/src/math/generic/expf.cpp +++ b/libc/src/math/expf.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/math/expf.h" -#include "exp_utils.h" -#include "math_utils.h" - +#include "expf.h" +#include "internal/exp_utils.h" +#include "internal/math_utils.h" #include "src/__support/common.h" #include diff --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/expm1f.cpp rename from libc/src/math/generic/expm1f.cpp rename to libc/src/math/expm1f.cpp --- a/libc/src/math/generic/expm1f.cpp +++ b/libc/src/math/expm1f.cpp @@ -6,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "src/math/expm1f.h" +#include "expm1f.h" +#include "expf.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/FPUtil/PolyEval.h" #include "src/__support/common.h" -#include "src/math/expf.h" namespace __llvm_libc { diff --git a/libc/src/math/generic/fabs.cpp b/libc/src/math/fabs.cpp rename from libc/src/math/generic/fabs.cpp rename to libc/src/math/fabs.cpp --- a/libc/src/math/generic/fabs.cpp +++ b/libc/src/math/fabs.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fabs.h" +#include "fabs.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fabsf.cpp b/libc/src/math/fabsf.cpp rename from libc/src/math/generic/fabsf.cpp rename to libc/src/math/fabsf.cpp --- a/libc/src/math/generic/fabsf.cpp +++ b/libc/src/math/fabsf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fabsf.h" +#include "fabsf.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fabsl.cpp b/libc/src/math/fabsl.cpp rename from libc/src/math/generic/fabsl.cpp rename to libc/src/math/fabsl.cpp --- a/libc/src/math/generic/fabsl.cpp +++ b/libc/src/math/fabsl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fabsl.h" +#include "fabsl.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fdim.cpp b/libc/src/math/fdim.cpp rename from libc/src/math/generic/fdim.cpp rename to libc/src/math/fdim.cpp --- a/libc/src/math/generic/fdim.cpp +++ b/libc/src/math/fdim.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fdim.h" +#include "fdim.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fdimf.cpp b/libc/src/math/fdimf.cpp rename from libc/src/math/generic/fdimf.cpp rename to libc/src/math/fdimf.cpp --- a/libc/src/math/generic/fdimf.cpp +++ b/libc/src/math/fdimf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fdimf.h" +#include "fdimf.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fdiml.cpp b/libc/src/math/fdiml.cpp rename from libc/src/math/generic/fdiml.cpp rename to libc/src/math/fdiml.cpp --- a/libc/src/math/generic/fdiml.cpp +++ b/libc/src/math/fdiml.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fdiml.h" +#include "fdiml.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/floor.cpp b/libc/src/math/floor.cpp rename from libc/src/math/generic/floor.cpp rename to libc/src/math/floor.cpp --- a/libc/src/math/generic/floor.cpp +++ b/libc/src/math/floor.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/floor.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/floor.cpp" +#else +#include "floor.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(double, floor, (double x)) { return fputil::floor(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/floorf.cpp b/libc/src/math/floorf.cpp rename from libc/src/math/generic/floorf.cpp rename to libc/src/math/floorf.cpp --- a/libc/src/math/generic/floorf.cpp +++ b/libc/src/math/floorf.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/floorf.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/floorf.cpp" +#else +#include "floorf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(float, floorf, (float x)) { return fputil::floor(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/floorl.cpp b/libc/src/math/floorl.cpp rename from libc/src/math/generic/floorl.cpp rename to libc/src/math/floorl.cpp --- a/libc/src/math/generic/floorl.cpp +++ b/libc/src/math/floorl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/floorl.h" +#include "floorl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/fma.cpp b/libc/src/math/fma.cpp --- a/libc/src/math/fma.cpp +++ b/libc/src/math/fma.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fma.h" +#include "fma.h" #include "src/__support/common.h" #include "src/__support/FPUtil/FMA.h" diff --git a/libc/src/math/fmaf.cpp b/libc/src/math/fmaf.cpp --- a/libc/src/math/fmaf.cpp +++ b/libc/src/math/fmaf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fmaf.h" +#include "fmaf.h" #include "src/__support/common.h" #include "src/__support/FPUtil/FMA.h" diff --git a/libc/src/math/generic/fmax.cpp b/libc/src/math/fmax.cpp rename from libc/src/math/generic/fmax.cpp rename to libc/src/math/fmax.cpp --- a/libc/src/math/generic/fmax.cpp +++ b/libc/src/math/fmax.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fmax.h" +#include "fmax.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fmaxf.cpp b/libc/src/math/fmaxf.cpp rename from libc/src/math/generic/fmaxf.cpp rename to libc/src/math/fmaxf.cpp --- a/libc/src/math/generic/fmaxf.cpp +++ b/libc/src/math/fmaxf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fmaxf.h" +#include "fmaxf.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fmaxl.cpp b/libc/src/math/fmaxl.cpp rename from libc/src/math/generic/fmaxl.cpp rename to libc/src/math/fmaxl.cpp --- a/libc/src/math/generic/fmaxl.cpp +++ b/libc/src/math/fmaxl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fmaxl.h" +#include "fmaxl.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fmin.cpp b/libc/src/math/fmin.cpp rename from libc/src/math/generic/fmin.cpp rename to libc/src/math/fmin.cpp --- a/libc/src/math/generic/fmin.cpp +++ b/libc/src/math/fmin.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fmin.h" +#include "fmin.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fminf.cpp b/libc/src/math/fminf.cpp rename from libc/src/math/generic/fminf.cpp rename to libc/src/math/fminf.cpp --- a/libc/src/math/generic/fminf.cpp +++ b/libc/src/math/fminf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fminf.h" +#include "fminf.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/fminl.cpp b/libc/src/math/fminl.cpp rename from libc/src/math/generic/fminl.cpp rename to libc/src/math/fminl.cpp --- a/libc/src/math/generic/fminl.cpp +++ b/libc/src/math/fminl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/fminl.h" +#include "fminl.h" #include "src/__support/FPUtil/BasicOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/frexp.cpp b/libc/src/math/frexp.cpp rename from libc/src/math/generic/frexp.cpp rename to libc/src/math/frexp.cpp --- a/libc/src/math/generic/frexp.cpp +++ b/libc/src/math/frexp.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/frexp.h" +#include "frexp.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/frexpf.cpp b/libc/src/math/frexpf.cpp rename from libc/src/math/generic/frexpf.cpp rename to libc/src/math/frexpf.cpp --- a/libc/src/math/generic/frexpf.cpp +++ b/libc/src/math/frexpf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/frexpf.h" +#include "frexpf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/frexpl.cpp b/libc/src/math/frexpl.cpp rename from libc/src/math/generic/frexpl.cpp rename to libc/src/math/frexpl.cpp --- a/libc/src/math/generic/frexpl.cpp +++ b/libc/src/math/frexpl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/frexpl.h" +#include "frexpl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt deleted file mode 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ /dev/null @@ -1,1006 +0,0 @@ -add_entrypoint_object( - ceil - SRCS - ceil.cpp - HDRS - ../ceil.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ceilf - SRCS - ceilf.cpp - HDRS - ../ceilf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ceill - SRCS - ceill.cpp - HDRS - ../ceill.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_object_library( - math_utils - SRCS - math_utils.cpp - HDRS - math_utils.h - DEPENDS - libc.include.errno - libc.include.math - libc.src.errno.__errno_location -) - -add_object_library( - sincosf_utils - HDRS - sincosf_utils.h - SRCS - sincosf_data.cpp - DEPENDS - .math_utils -) - -add_entrypoint_object( - cosf - SRCS - cosf.cpp - HDRS - ../cosf.h - DEPENDS - .sincosf_utils - libc.include.math - libc.src.errno.__errno_location -) - -add_entrypoint_object( - sinf - SRCS - sinf.cpp - HDRS - ../sinf.h - DEPENDS - .sincosf_utils - libc.include.math - libc.src.errno.__errno_location - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O3 -) - -add_entrypoint_object( - sincosf - SRCS - sincosf.cpp - HDRS - ../sincosf.h - DEPENDS - .sincosf_utils - libc.include.math - libc.src.errno.__errno_location -) - -add_entrypoint_object( - fabs - SRCS - fabs.cpp - HDRS - ../fabs.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fabsf - SRCS - fabsf.cpp - HDRS - ../fabsf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fabsl - SRCS - fabsl.cpp - HDRS - ../fabsl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - trunc - SRCS - trunc.cpp - HDRS - ../trunc.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - truncf - SRCS - truncf.cpp - HDRS - ../truncf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - truncl - SRCS - truncl.cpp - HDRS - ../truncl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - floor - SRCS - floor.cpp - HDRS - ../floor.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - floorf - SRCS - floorf.cpp - HDRS - ../floorf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - floorl - SRCS - floorl.cpp - HDRS - ../floorl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - round - SRCS - round.cpp - HDRS - ../round.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - roundf - SRCS - roundf.cpp - HDRS - ../roundf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - roundl - SRCS - roundl.cpp - HDRS - ../roundl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lround - SRCS - lround.cpp - HDRS - ../lround.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lroundf - SRCS - lroundf.cpp - HDRS - ../lroundf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lroundl - SRCS - lroundl.cpp - HDRS - ../lroundl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llround - SRCS - llround.cpp - HDRS - ../llround.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llroundf - SRCS - llroundf.cpp - HDRS - ../llroundf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llroundl - SRCS - llroundl.cpp - HDRS - ../llroundl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - rint - SRCS - rint.cpp - HDRS - ../rint.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - rintf - SRCS - rintf.cpp - HDRS - ../rintf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - rintl - SRCS - rintl.cpp - HDRS - ../rintl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lrint - SRCS - lrint.cpp - HDRS - ../lrint.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lrintf - SRCS - lrintf.cpp - HDRS - ../lrintf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - lrintl - SRCS - lrintl.cpp - HDRS - ../lrintl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llrint - SRCS - llrint.cpp - HDRS - ../llrint.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llrintf - SRCS - llrintf.cpp - HDRS - ../llrintf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - llrintl - SRCS - llrintl.cpp - HDRS - ../llrintl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nearbyint - SRCS - nearbyint.cpp - HDRS - ../nearbyint.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nearbyintf - SRCS - nearbyintf.cpp - HDRS - ../nearbyintf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nearbyintl - SRCS - nearbyintl.cpp - HDRS - ../nearbyintl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_object_library( - exp_utils - HDRS - exp_utils.h - SRCS - exp_utils.cpp - DEPENDS - .math_utils -) - -add_entrypoint_object( - expf - SRCS - expf.cpp - HDRS - ../expf.h - DEPENDS - .exp_utils - .math_utils - libc.include.math -) - -add_entrypoint_object( - exp2f - SRCS - exp2f.cpp - HDRS - ../exp2f.h - DEPENDS - .exp_utils - .math_utils - libc.include.math -) - -add_entrypoint_object( - expm1f - SRCS - expm1f.cpp - HDRS - ../expm1f.h - DEPENDS - libc.include.math - libc.src.math.expf - libc.src.math.fabsf -) - -add_entrypoint_object( - copysign - SRCS - copysign.cpp - HDRS - ../copysign.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - copysignf - SRCS - copysignf.cpp - HDRS - ../copysignf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - copysignl - SRCS - copysignl.cpp - HDRS - ../copysignl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - frexp - SRCS - frexp.cpp - HDRS - ../frexp.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - frexpf - SRCS - frexpf.cpp - HDRS - ../frexpf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - frexpl - SRCS - frexpl.cpp - HDRS - ../frexpl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ilogb - SRCS - ilogb.cpp - HDRS - ../ilogb.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ilogbf - SRCS - ilogbf.cpp - HDRS - ../ilogbf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ilogbl - SRCS - ilogbl.cpp - HDRS - ../ilogbl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ldexp - SRCS - ldexp.cpp - HDRS - ../ldexp.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ldexpf - SRCS - ldexpf.cpp - HDRS - ../ldexpf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - ldexpl - SRCS - ldexpl.cpp - HDRS - ../ldexpl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - logb - SRCS - logb.cpp - HDRS - ../logb.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - logbf - SRCS - logbf.cpp - HDRS - ../logbf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - logbl - SRCS - logbl.cpp - HDRS - ../logbl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - modf - SRCS - modf.cpp - HDRS - ../modf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - modff - SRCS - modff.cpp - HDRS - ../modff.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - modfl - SRCS - modfl.cpp - HDRS - ../modfl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fmin - SRCS - fmin.cpp - HDRS - ../fmin.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fminf - SRCS - fminf.cpp - HDRS - ../fminf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fminl - SRCS - fminl.cpp - HDRS - ../fminl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fmax - SRCS - fmax.cpp - HDRS - ../fmax.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fmaxf - SRCS - fmaxf.cpp - HDRS - ../fmaxf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fmaxl - SRCS - fmaxl.cpp - HDRS - ../fmaxl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrt - SRCS - sqrt.cpp - HDRS - ../sqrt.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrtf - SRCS - sqrtf.cpp - HDRS - ../sqrtf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrtl - SRCS - sqrtl.cpp - HDRS - ../sqrtl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remquof - SRCS - remquof.cpp - HDRS - ../remquof.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remquo - SRCS - remquo.cpp - HDRS - ../remquo.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remquol - SRCS - remquol.cpp - HDRS - ../remquol.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remainderf - SRCS - remainderf.cpp - HDRS - ../remainderf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remainder - SRCS - remainder.cpp - HDRS - ../remainder.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - remainderl - SRCS - remainderl.cpp - HDRS - ../remainderl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - hypotf - SRCS - hypotf.cpp - HDRS - ../hypotf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fdim - SRCS - fdim.cpp - HDRS - ../fdim.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fdimf - SRCS - fdimf.cpp - HDRS - ../fdimf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - fdiml - SRCS - fdiml.cpp - HDRS - ../fdiml.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - hypot - SRCS - hypot.cpp - HDRS - ../hypot.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nextafter - SRCS - nextafter.cpp - HDRS - ../nextafter.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nextafterf - SRCS - nextafterf.cpp - HDRS - ../nextafterf.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - nextafterl - SRCS - nextafterl.cpp - HDRS - ../nextafterl.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O2 -) - -add_object_library( - dp_trig - SRCS - dp_trig.cpp - HDRS - dp_trig.h - DEPENDS - libc.src.__support.FPUtil.fputil - COMPILE_OPTIONS - -O3 -) diff --git a/libc/src/math/generic/hypot.cpp b/libc/src/math/hypot.cpp rename from libc/src/math/generic/hypot.cpp rename to libc/src/math/hypot.cpp --- a/libc/src/math/generic/hypot.cpp +++ b/libc/src/math/hypot.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/hypot.h" +#include "hypot.h" #include "src/__support/FPUtil/Hypot.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/hypotf.cpp b/libc/src/math/hypotf.cpp rename from libc/src/math/generic/hypotf.cpp rename to libc/src/math/hypotf.cpp --- a/libc/src/math/generic/hypotf.cpp +++ b/libc/src/math/hypotf.cpp @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -#include "src/math/hypotf.h" +#include "hypotf.h" #include "src/__support/FPUtil/Hypot.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/ilogb.cpp b/libc/src/math/ilogb.cpp rename from libc/src/math/generic/ilogb.cpp rename to libc/src/math/ilogb.cpp --- a/libc/src/math/generic/ilogb.cpp +++ b/libc/src/math/ilogb.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ilogb.h" +#include "ilogb.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/ilogbf.cpp b/libc/src/math/ilogbf.cpp rename from libc/src/math/generic/ilogbf.cpp rename to libc/src/math/ilogbf.cpp --- a/libc/src/math/generic/ilogbf.cpp +++ b/libc/src/math/ilogbf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ilogbf.h" +#include "ilogbf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/ilogbl.cpp b/libc/src/math/ilogbl.cpp rename from libc/src/math/generic/ilogbl.cpp rename to libc/src/math/ilogbl.cpp --- a/libc/src/math/generic/ilogbl.cpp +++ b/libc/src/math/ilogbl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ilogbl.h" +#include "ilogbl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/internal/CMakeLists.txt b/libc/src/math/internal/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/libc/src/math/internal/CMakeLists.txt @@ -0,0 +1,31 @@ +add_object_library( + math_utils + SRCS math_utils.cpp + HDRS math_utils.h + DEPENDS + libc.include.errno + libc.include.math + libc.src.errno.__errno_location +) + +add_object_library( + sincosf_utils + HDRS sincosf_utils.h + SRCS sincosf_data.cpp + DEPENDS .math_utils +) + +add_object_library( + exp_utils + HDRS exp_utils.h + SRCS exp_utils.cpp + DEPENDS .math_utils +) + +add_object_library( + dp_trig + SRCS dp_trig.cpp + HDRS dp_trig.h + DEPENDS libc.src.__support.FPUtil.fputil + COMPILE_OPTIONS -O3 +) diff --git a/libc/src/math/generic/dp_trig.h b/libc/src/math/internal/dp_trig.h rename from libc/src/math/generic/dp_trig.h rename to libc/src/math/internal/dp_trig.h diff --git a/libc/src/math/generic/dp_trig.cpp b/libc/src/math/internal/dp_trig.cpp rename from libc/src/math/generic/dp_trig.cpp rename to libc/src/math/internal/dp_trig.cpp diff --git a/libc/src/math/generic/exp_utils.h b/libc/src/math/internal/exp_utils.h rename from libc/src/math/generic/exp_utils.h rename to libc/src/math/internal/exp_utils.h diff --git a/libc/src/math/generic/exp_utils.cpp b/libc/src/math/internal/exp_utils.cpp rename from libc/src/math/generic/exp_utils.cpp rename to libc/src/math/internal/exp_utils.cpp diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/internal/math_utils.h rename from libc/src/math/generic/math_utils.h rename to libc/src/math/internal/math_utils.h diff --git a/libc/src/math/generic/math_utils.cpp b/libc/src/math/internal/math_utils.cpp rename from libc/src/math/generic/math_utils.cpp rename to libc/src/math/internal/math_utils.cpp diff --git a/libc/src/math/generic/sincosf_data.cpp b/libc/src/math/internal/sincosf_data.cpp rename from libc/src/math/generic/sincosf_data.cpp rename to libc/src/math/internal/sincosf_data.cpp diff --git a/libc/src/math/generic/sincosf_utils.h b/libc/src/math/internal/sincosf_utils.h rename from libc/src/math/generic/sincosf_utils.h rename to libc/src/math/internal/sincosf_utils.h diff --git a/libc/src/math/generic/ldexp.cpp b/libc/src/math/ldexp.cpp rename from libc/src/math/generic/ldexp.cpp rename to libc/src/math/ldexp.cpp --- a/libc/src/math/generic/ldexp.cpp +++ b/libc/src/math/ldexp.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ldexp.h" +#include "ldexp.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/ldexpf.cpp b/libc/src/math/ldexpf.cpp rename from libc/src/math/generic/ldexpf.cpp rename to libc/src/math/ldexpf.cpp --- a/libc/src/math/generic/ldexpf.cpp +++ b/libc/src/math/ldexpf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ldexpf.h" +#include "ldexpf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/ldexpl.cpp b/libc/src/math/ldexpl.cpp rename from libc/src/math/generic/ldexpl.cpp rename to libc/src/math/ldexpl.cpp --- a/libc/src/math/generic/ldexpl.cpp +++ b/libc/src/math/ldexpl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/ldexpl.h" +#include "ldexpl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llrint.cpp b/libc/src/math/llrint.cpp rename from libc/src/math/generic/llrint.cpp rename to libc/src/math/llrint.cpp --- a/libc/src/math/generic/llrint.cpp +++ b/libc/src/math/llrint.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llrint.h" +#include "llrint.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llrintf.cpp b/libc/src/math/llrintf.cpp rename from libc/src/math/generic/llrintf.cpp rename to libc/src/math/llrintf.cpp --- a/libc/src/math/generic/llrintf.cpp +++ b/libc/src/math/llrintf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llrintf.h" +#include "llrintf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llrintl.cpp b/libc/src/math/llrintl.cpp rename from libc/src/math/generic/llrintl.cpp rename to libc/src/math/llrintl.cpp --- a/libc/src/math/generic/llrintl.cpp +++ b/libc/src/math/llrintl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llrintl.h" +#include "llrintl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llround.cpp b/libc/src/math/llround.cpp rename from libc/src/math/generic/llround.cpp rename to libc/src/math/llround.cpp --- a/libc/src/math/generic/llround.cpp +++ b/libc/src/math/llround.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llround.h" +#include "llround.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llroundf.cpp b/libc/src/math/llroundf.cpp rename from libc/src/math/generic/llroundf.cpp rename to libc/src/math/llroundf.cpp --- a/libc/src/math/generic/llroundf.cpp +++ b/libc/src/math/llroundf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llroundf.h" +#include "llroundf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/llroundl.cpp b/libc/src/math/llroundl.cpp rename from libc/src/math/generic/llroundl.cpp rename to libc/src/math/llroundl.cpp --- a/libc/src/math/generic/llroundl.cpp +++ b/libc/src/math/llroundl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/llroundl.h" +#include "llroundl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/logb.cpp b/libc/src/math/logb.cpp rename from libc/src/math/generic/logb.cpp rename to libc/src/math/logb.cpp --- a/libc/src/math/generic/logb.cpp +++ b/libc/src/math/logb.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/logb.h" +#include "logb.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/logbf.cpp b/libc/src/math/logbf.cpp rename from libc/src/math/generic/logbf.cpp rename to libc/src/math/logbf.cpp --- a/libc/src/math/generic/logbf.cpp +++ b/libc/src/math/logbf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/logbf.h" +#include "logbf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/logbl.cpp b/libc/src/math/logbl.cpp rename from libc/src/math/generic/logbl.cpp rename to libc/src/math/logbl.cpp --- a/libc/src/math/generic/logbl.cpp +++ b/libc/src/math/logbl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/logbl.h" +#include "logbl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lrint.cpp b/libc/src/math/lrint.cpp rename from libc/src/math/generic/lrint.cpp rename to libc/src/math/lrint.cpp --- a/libc/src/math/generic/lrint.cpp +++ b/libc/src/math/lrint.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lrint.h" +#include "lrint.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lrintf.cpp b/libc/src/math/lrintf.cpp rename from libc/src/math/generic/lrintf.cpp rename to libc/src/math/lrintf.cpp --- a/libc/src/math/generic/lrintf.cpp +++ b/libc/src/math/lrintf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lrintf.h" +#include "lrintf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lrintl.cpp b/libc/src/math/lrintl.cpp rename from libc/src/math/generic/lrintl.cpp rename to libc/src/math/lrintl.cpp --- a/libc/src/math/generic/lrintl.cpp +++ b/libc/src/math/lrintl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lrintl.h" +#include "lrintl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lround.cpp b/libc/src/math/lround.cpp rename from libc/src/math/generic/lround.cpp rename to libc/src/math/lround.cpp --- a/libc/src/math/generic/lround.cpp +++ b/libc/src/math/lround.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lround.h" +#include "lround.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lroundf.cpp b/libc/src/math/lroundf.cpp rename from libc/src/math/generic/lroundf.cpp rename to libc/src/math/lroundf.cpp --- a/libc/src/math/generic/lroundf.cpp +++ b/libc/src/math/lroundf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lroundf.h" +#include "lroundf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/lroundl.cpp b/libc/src/math/lroundl.cpp rename from libc/src/math/generic/lroundl.cpp rename to libc/src/math/lroundl.cpp --- a/libc/src/math/generic/lroundl.cpp +++ b/libc/src/math/lroundl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/lroundl.h" +#include "lroundl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/modf.cpp b/libc/src/math/modf.cpp rename from libc/src/math/generic/modf.cpp rename to libc/src/math/modf.cpp --- a/libc/src/math/generic/modf.cpp +++ b/libc/src/math/modf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/modf.h" +#include "modf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/modff.cpp b/libc/src/math/modff.cpp rename from libc/src/math/generic/modff.cpp rename to libc/src/math/modff.cpp --- a/libc/src/math/generic/modff.cpp +++ b/libc/src/math/modff.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/modff.h" +#include "modff.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/modfl.cpp b/libc/src/math/modfl.cpp rename from libc/src/math/generic/modfl.cpp rename to libc/src/math/modfl.cpp --- a/libc/src/math/generic/modfl.cpp +++ b/libc/src/math/modfl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/modfl.h" +#include "modfl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nearbyint.cpp b/libc/src/math/nearbyint.cpp rename from libc/src/math/generic/nearbyint.cpp rename to libc/src/math/nearbyint.cpp --- a/libc/src/math/generic/nearbyint.cpp +++ b/libc/src/math/nearbyint.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nearbyint.h" +#include "nearbyint.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nearbyintf.cpp b/libc/src/math/nearbyintf.cpp rename from libc/src/math/generic/nearbyintf.cpp rename to libc/src/math/nearbyintf.cpp --- a/libc/src/math/generic/nearbyintf.cpp +++ b/libc/src/math/nearbyintf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nearbyintf.h" +#include "nearbyintf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nearbyintl.cpp b/libc/src/math/nearbyintl.cpp rename from libc/src/math/generic/nearbyintl.cpp rename to libc/src/math/nearbyintl.cpp --- a/libc/src/math/generic/nearbyintl.cpp +++ b/libc/src/math/nearbyintl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nearbyintl.h" +#include "nearbyintl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nextafter.cpp b/libc/src/math/nextafter.cpp rename from libc/src/math/generic/nextafter.cpp rename to libc/src/math/nextafter.cpp --- a/libc/src/math/generic/nextafter.cpp +++ b/libc/src/math/nextafter.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nextafter.h" +#include "nextafter.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nextafterf.cpp b/libc/src/math/nextafterf.cpp rename from libc/src/math/generic/nextafterf.cpp rename to libc/src/math/nextafterf.cpp --- a/libc/src/math/generic/nextafterf.cpp +++ b/libc/src/math/nextafterf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nextafterf.h" +#include "nextafterf.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/nextafterl.cpp b/libc/src/math/nextafterl.cpp rename from libc/src/math/generic/nextafterl.cpp rename to libc/src/math/nextafterl.cpp --- a/libc/src/math/generic/nextafterl.cpp +++ b/libc/src/math/nextafterl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/nextafterl.h" +#include "nextafterl.h" #include "src/__support/FPUtil/ManipulationFunctions.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remainder.cpp b/libc/src/math/remainder.cpp rename from libc/src/math/generic/remainder.cpp rename to libc/src/math/remainder.cpp --- a/libc/src/math/generic/remainder.cpp +++ b/libc/src/math/remainder.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remainder.h" +#include "remainder.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remainderf.cpp b/libc/src/math/remainderf.cpp rename from libc/src/math/generic/remainderf.cpp rename to libc/src/math/remainderf.cpp --- a/libc/src/math/generic/remainderf.cpp +++ b/libc/src/math/remainderf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remainderf.h" +#include "remainderf.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remainderl.cpp b/libc/src/math/remainderl.cpp rename from libc/src/math/generic/remainderl.cpp rename to libc/src/math/remainderl.cpp --- a/libc/src/math/generic/remainderl.cpp +++ b/libc/src/math/remainderl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remainderl.h" +#include "remainderl.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remquo.cpp b/libc/src/math/remquo.cpp rename from libc/src/math/generic/remquo.cpp rename to libc/src/math/remquo.cpp --- a/libc/src/math/generic/remquo.cpp +++ b/libc/src/math/remquo.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remquo.h" +#include "remquo.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remquof.cpp b/libc/src/math/remquof.cpp rename from libc/src/math/generic/remquof.cpp rename to libc/src/math/remquof.cpp --- a/libc/src/math/generic/remquof.cpp +++ b/libc/src/math/remquof.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remquof.h" +#include "remquof.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/remquol.cpp b/libc/src/math/remquol.cpp rename from libc/src/math/generic/remquol.cpp rename to libc/src/math/remquol.cpp --- a/libc/src/math/generic/remquol.cpp +++ b/libc/src/math/remquol.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/remquol.h" +#include "remquol.h" #include "src/__support/FPUtil/DivisionAndRemainderOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/rint.cpp b/libc/src/math/rint.cpp rename from libc/src/math/generic/rint.cpp rename to libc/src/math/rint.cpp --- a/libc/src/math/generic/rint.cpp +++ b/libc/src/math/rint.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/rint.h" +#include "rint.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/rintf.cpp b/libc/src/math/rintf.cpp rename from libc/src/math/generic/rintf.cpp rename to libc/src/math/rintf.cpp --- a/libc/src/math/generic/rintf.cpp +++ b/libc/src/math/rintf.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/rintf.h" +#include "rintf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/rintl.cpp b/libc/src/math/rintl.cpp rename from libc/src/math/generic/rintl.cpp rename to libc/src/math/rintl.cpp --- a/libc/src/math/generic/rintl.cpp +++ b/libc/src/math/rintl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/rintl.h" +#include "rintl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/round.cpp b/libc/src/math/round.cpp rename from libc/src/math/generic/round.cpp rename to libc/src/math/round.cpp --- a/libc/src/math/generic/round.cpp +++ b/libc/src/math/round.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/round.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/round.cpp" +#else +#include "round.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(double, round, (double x)) { return fputil::round(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/roundf.cpp b/libc/src/math/roundf.cpp rename from libc/src/math/generic/roundf.cpp rename to libc/src/math/roundf.cpp --- a/libc/src/math/generic/roundf.cpp +++ b/libc/src/math/roundf.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/roundf.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/roundf.cpp" +#else +#include "roundf.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" @@ -15,3 +20,4 @@ LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return fputil::round(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/roundl.cpp b/libc/src/math/roundl.cpp rename from libc/src/math/generic/roundl.cpp rename to libc/src/math/roundl.cpp --- a/libc/src/math/generic/roundl.cpp +++ b/libc/src/math/roundl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/roundl.h" +#include "roundl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/sin.cpp copy from libc/src/math/generic/sqrt.cpp copy to libc/src/math/sin.cpp --- a/libc/src/math/generic/sqrt.cpp +++ b/libc/src/math/sin.cpp @@ -1,4 +1,4 @@ -//===-- Implementation of sqrt function -----------------------------------===// +//===-- Implementation of the sin function --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,12 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrt.h" -#include "src/__support/FPUtil/Sqrt.h" -#include "src/__support/common.h" +#include "src/__support/architectures.h" -namespace __llvm_libc { - -LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); } - -} // namespace __llvm_libc +#if defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/sin.cpp" +#endif diff --git a/libc/src/math/generic/sincosf.cpp b/libc/src/math/sincosf.cpp rename from libc/src/math/generic/sincosf.cpp rename to libc/src/math/sincosf.cpp --- a/libc/src/math/generic/sincosf.cpp +++ b/libc/src/math/sincosf.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sincosf.h" -#include "math_utils.h" -#include "sincosf_utils.h" - +#include "sincosf.h" +#include "internal/math_utils.h" +#include "internal/sincosf_utils.h" #include "src/__support/common.h" #include diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/sinf.cpp rename from libc/src/math/generic/sinf.cpp rename to libc/src/math/sinf.cpp --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/sinf.cpp @@ -6,10 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sinf.h" -#include "math_utils.h" -#include "sincosf_utils.h" - +#include "sinf.h" +#include "internal/math_utils.h" +#include "internal/sincosf_utils.h" #include "src/__support/common.h" #include diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/sqrt.cpp copy from libc/src/math/generic/sqrt.cpp copy to libc/src/math/sqrt.cpp --- a/libc/src/math/generic/sqrt.cpp +++ b/libc/src/math/sqrt.cpp @@ -6,12 +6,19 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrt.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/sqrt.cpp" +#elif defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/sqrt.cpp" +#else +#include "sqrt.h" #include "src/__support/FPUtil/Sqrt.h" #include "src/__support/common.h" - namespace __llvm_libc { LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/sqrtf.cpp b/libc/src/math/sqrtf.cpp rename from libc/src/math/generic/sqrtf.cpp rename to libc/src/math/sqrtf.cpp --- a/libc/src/math/generic/sqrtf.cpp +++ b/libc/src/math/sqrtf.cpp @@ -6,7 +6,14 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrtf.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/sqrtf.cpp" +#elif defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/sqrtf.cpp" +#else +#include "sqrtf.h" #include "src/__support/FPUtil/Sqrt.h" #include "src/__support/common.h" @@ -15,3 +22,4 @@ LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return fputil::sqrt(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/sqrtl.cpp b/libc/src/math/sqrtl.cpp rename from libc/src/math/generic/sqrtl.cpp rename to libc/src/math/sqrtl.cpp --- a/libc/src/math/generic/sqrtl.cpp +++ b/libc/src/math/sqrtl.cpp @@ -6,7 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrtl.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/sqrtl.cpp" +#else +#include "sqrtl.h" #include "src/__support/FPUtil/Sqrt.h" #include "src/__support/common.h" @@ -17,3 +22,4 @@ } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/tan.cpp rename from libc/src/math/generic/sqrt.cpp rename to libc/src/math/tan.cpp --- a/libc/src/math/generic/sqrt.cpp +++ b/libc/src/math/tan.cpp @@ -1,4 +1,4 @@ -//===-- Implementation of sqrt function -----------------------------------===// +//===-- Implementation of the tan function --------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,12 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "src/math/sqrt.h" -#include "src/__support/FPUtil/Sqrt.h" -#include "src/__support/common.h" +#include "src/__support/architectures.h" -namespace __llvm_libc { - -LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return fputil::sqrt(x); } - -} // namespace __llvm_libc +#if defined(LLVM_LIBC_ARCH_X86) +#include "x86_64/tan.cpp" +#endif diff --git a/libc/src/math/generic/trunc.cpp b/libc/src/math/trunc.cpp rename from libc/src/math/generic/trunc.cpp rename to libc/src/math/trunc.cpp --- a/libc/src/math/generic/trunc.cpp +++ b/libc/src/math/trunc.cpp @@ -6,12 +6,18 @@ // //===----------------------------------------------------------------------===// -#include "src/math/trunc.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/trunc.cpp" +#else #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" +#include "trunc.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return fputil::trunc(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/truncf.cpp b/libc/src/math/truncf.cpp rename from libc/src/math/generic/truncf.cpp rename to libc/src/math/truncf.cpp --- a/libc/src/math/generic/truncf.cpp +++ b/libc/src/math/truncf.cpp @@ -6,12 +6,18 @@ // //===----------------------------------------------------------------------===// -#include "src/math/truncf.h" +#include "src/__support/architectures.h" + +#if defined(LLVM_LIBC_ARCH_AARCH64) +#include "aarch64/truncf.cpp" +#else #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" +#include "truncf.h" namespace __llvm_libc { LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return fputil::trunc(x); } } // namespace __llvm_libc +#endif diff --git a/libc/src/math/generic/truncl.cpp b/libc/src/math/truncl.cpp rename from libc/src/math/generic/truncl.cpp rename to libc/src/math/truncl.cpp --- a/libc/src/math/generic/truncl.cpp +++ b/libc/src/math/truncl.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "src/math/truncl.h" +#include "truncl.h" #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" diff --git a/libc/src/math/x86_64/CMakeLists.txt b/libc/src/math/x86_64/CMakeLists.txt deleted file mode 100644 --- a/libc/src/math/x86_64/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -add_entrypoint_object( - cos - SRCS - cos.cpp - HDRS - ../cos.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sin - SRCS - sin.cpp - HDRS - ../sin.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - tan - SRCS - tan.cpp - HDRS - ../tan.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrt - SRCS - sqrt.cpp - HDRS - ../sqrt.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrtf - SRCS - sqrtf.cpp - HDRS - ../sqrtf.h - COMPILE_OPTIONS - -O2 -) - -add_entrypoint_object( - sqrtl - SRCS - sqrtl.cpp - HDRS - ../sqrtl.h - COMPILE_OPTIONS - -O2 -)