[libc-commits] [libc] [llvm] [libc][math] Optimize integer-only expf and add integer-only exp2f and exp10f (PR #228898)
via libc-commits
libc-commits at lists.llvm.org
Sun Oct 4 08:01:43 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libc/shared/math/static_rounding/exp10f.h libc/shared/math/static_rounding/exp2f.h libc/src/__support/math/exp10f_integer_eval.h libc/src/__support/math/exp2f_integer_eval.h libc/src/__support/math/exp2f_integer_utils.h libc/shared/math/static_rounding/expf.h libc/shared/static_rounding_math.h libc/src/__support/big_int.h libc/src/__support/frac64.h libc/src/__support/math/exp10f.h libc/src/__support/math/exp2f.h libc/src/__support/math/expf_integer_eval.h libc/test/shared/shared_math_test.cpp libc/test/src/__support/big_int_test.cpp libc/test/src/math/exhaustive/exp10f_test.cpp libc/test/src/math/exhaustive/exp2f_test.cpp libc/test/src/math/exhaustive/expf_test.cpp libc/test/src/math/exp10f_test.cpp libc/test/src/math/exp2f_test.cpp libc/test/src/math/expf_test.cpp libc/test/src/math/smoke/exp10f_test.cpp libc/test/src/math/smoke/exp2f_test.cpp libc/test/src/math/smoke/expf_test.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/__support/big_int.h b/libc/src/__support/big_int.h
index b21d23471..ddfe1c27f 100644
--- a/libc/src/__support/big_int.h
+++ b/libc/src/__support/big_int.h
@@ -69,13 +69,11 @@ LIBC_ALWAYS_INLINE constexpr T hi(const DoubleWide<T> &value) {
return value[1];
}
// The low part of an unsigned value.
-template <typename T>
-LIBC_ALWAYS_INLINE constexpr half_width_t<T> lo(T value) {
+template <typename T> LIBC_ALWAYS_INLINE constexpr half_width_t<T> lo(T value) {
return lo(split(value));
}
// The high part of an unsigned value.
-template <typename T>
-LIBC_ALWAYS_INLINE constexpr half_width_t<T> hi(T value) {
+template <typename T> LIBC_ALWAYS_INLINE constexpr half_width_t<T> hi(T value) {
return hi(split(value));
}
@@ -673,7 +671,8 @@ public:
// `Bits` least significant bits of the full product, while this function will
// approximate `Bits` most significant bits of the full product with errors
// bounded by:
- // 0 <= (a.full_mul(b) >> Bits) - a.quick_mul_hi(b)) <= max(WORD_COUNT - 1, 1)
+ // 0 <= (a.full_mul(b) >> Bits) - a.quick_mul_hi(b)) <= max(WORD_COUNT - 1,
+ // 1)
// (when WORD_COUNT == 1 and WordType is natively supported by a double-width
// integer type, the error is 0; otherwise when split into half-words, the
// error is bounded by 1).
``````````
</details>
https://github.com/llvm/llvm-project/pull/228898
More information about the libc-commits
mailing list