[libc-commits] [libc] [libc] Add bare-metal Hexagon port (PR #217528)
via libc-commits
libc-commits at lists.llvm.org
Wed Aug 19 22:54:22 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/include/llvm-libc-macros/baremetal/signal-macros.h libc/src/__support/FPUtil/hexagon/FEnvImpl.h libc/startup/baremetal/hexagon/start.cpp libc/test/UnitTest/HexagonBaremetalTestUtils.cpp libc/include/llvm-libc-macros/signal-macros.h libc/include/llvm-libc-types/fenv_t.h libc/src/__support/FPUtil/FEnvImpl.h libc/src/__support/macros/properties/architectures.h libc/src/__support/memory_size.h libc/test/UnitTest/LibcTest.h libc/test/src/math/smoke/exp10m1f_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/FPUtil/hexagon/FEnvImpl.h b/libc/src/__support/FPUtil/hexagon/FEnvImpl.h
index 7cd6b94ff..1dc72d1bc 100644
--- a/libc/src/__support/FPUtil/hexagon/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/hexagon/FEnvImpl.h
@@ -39,11 +39,11 @@ namespace fputil {
// values used by llvm-libc, so we translate between the two below.
struct FEnv {
// Hardware status-flag bit positions within USR.
- static constexpr uint32_t INVALID = 0x02; // bit 1
- static constexpr uint32_t DIVBYZERO = 0x04; // bit 2
- static constexpr uint32_t OVERFLOW = 0x08; // bit 3
- static constexpr uint32_t UNDERFLOW = 0x10; // bit 4
- static constexpr uint32_t INEXACT = 0x20; // bit 5
+ static constexpr uint32_t INVALID = 0x02; // bit 1
+ static constexpr uint32_t DIVBYZERO = 0x04; // bit 2
+ static constexpr uint32_t OVERFLOW = 0x08; // bit 3
+ static constexpr uint32_t UNDERFLOW = 0x10; // bit 4
+ static constexpr uint32_t INEXACT = 0x20; // bit 5
static constexpr uint32_t STATUS_MASK =
INVALID | DIVBYZERO | OVERFLOW | UNDERFLOW | INEXACT;
@@ -97,8 +97,7 @@ struct FEnv {
LIBC_INLINE int enable_except(int excepts) {
uint32_t usr = FEnv::get_usr();
uint32_t old_enabled = (usr >> FEnv::ENABLE_SHIFT) & FEnv::STATUS_MASK;
- uint32_t new_enabled =
- old_enabled | FEnv::exception_macro_to_bits(excepts);
+ uint32_t new_enabled = old_enabled | FEnv::exception_macro_to_bits(excepts);
FEnv::set_usr((usr & ~FEnv::ENABLE_MASK) |
(new_enabled << FEnv::ENABLE_SHIFT));
return FEnv::exception_bits_to_macro(old_enabled);
@@ -107,15 +106,15 @@ LIBC_INLINE int enable_except(int excepts) {
LIBC_INLINE int disable_except(int excepts) {
uint32_t usr = FEnv::get_usr();
uint32_t old_enabled = (usr >> FEnv::ENABLE_SHIFT) & FEnv::STATUS_MASK;
- uint32_t new_enabled =
- old_enabled & ~FEnv::exception_macro_to_bits(excepts);
+ uint32_t new_enabled = old_enabled & ~FEnv::exception_macro_to_bits(excepts);
FEnv::set_usr((usr & ~FEnv::ENABLE_MASK) |
(new_enabled << FEnv::ENABLE_SHIFT));
return FEnv::exception_bits_to_macro(old_enabled);
}
LIBC_INLINE int get_except() {
- uint32_t enabled = (FEnv::get_usr() >> FEnv::ENABLE_SHIFT) & FEnv::STATUS_MASK;
+ uint32_t enabled =
+ (FEnv::get_usr() >> FEnv::ENABLE_SHIFT) & FEnv::STATUS_MASK;
return FEnv::exception_bits_to_macro(enabled);
}
diff --git a/libc/test/src/math/smoke/exp10m1f_test.cpp b/libc/test/src/math/smoke/exp10m1f_test.cpp
index ab41adfdf..6f51abbd1 100644
--- a/libc/test/src/math/smoke/exp10m1f_test.cpp
+++ b/libc/test/src/math/smoke/exp10m1f_test.cpp
@@ -20,7 +20,8 @@ TEST_F(LlvmLibcExp10m1fTest, SpecialNumbers) {
// Use EXPECT_FP_EQ (which treats any two NaNs as equal) rather than comparing
// raw bit patterns: exp10m1f(NaN) is computed as NaN + inf, and some targets
// (e.g. Hexagon) produce a non-canonical NaN encoding (0xFFFFFFFF) instead of
- // the canonical quiet NaN. Both are valid NaNs, so only require NaN-ness here.
+ // the canonical quiet NaN. Both are valid NaNs, so only require NaN-ness
+ // here.
EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10m1f(aNaN));
EXPECT_FP_EQ(neg_aNaN, LIBC_NAMESPACE::exp10m1f(neg_aNaN));
EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::exp10m1f(inf));
``````````
</details>
https://github.com/llvm/llvm-project/pull/217528
More information about the libc-commits
mailing list