[libc-commits] [libc] [libc][NFC] Simplify FPBits expressions (PR #78590)

via libc-commits libc-commits at lists.llvm.org
Thu Jan 18 06:50:49 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/78590.diff


3 Files Affected:

- (modified) libc/src/__support/FPUtil/aarch64/FEnvImpl.h (+2-2) 
- (modified) libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h (+2-2) 
- (modified) libc/src/__support/FPUtil/arm/FEnvImpl.h (+2-2) 


``````````diff
diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index 47c65af452809b..23cde88c9c7c5b 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -155,8 +155,8 @@ LIBC_INLINE int set_except(int excepts) {
 LIBC_INLINE int raise_except(int excepts) {
   float zero = 0.0f;
   float one = 1.0f;
-  float largeValue = float(FPBits<float>(FPBits<float>::MAX_NORMAL));
-  float smallValue = float(FPBits<float>(FPBits<float>::MIN_NORMAL));
+  float largeValue = FPBits<float>::max_normal();
+  float smallValue = FPBits<float>::min_normal();
   auto divfunc = [](float a, float b) {
     __asm__ __volatile__("ldr  s0, %0\n\t"
                          "ldr  s1, %1\n\t"
diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index 6a0ac5fef0cac5..ea1fd68a5fcdfc 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -161,8 +161,8 @@ LIBC_INLINE int set_except(int excepts) {
 LIBC_INLINE int raise_except(int excepts) {
   float zero = 0.0f;
   float one = 1.0f;
-  float large_value = float(FPBits<float>(FPBits<float>::MAX_NORMAL));
-  float small_value = float(FPBits<float>(FPBits<float>::MIN_NORMAL));
+  float large_value = FPBits<float>::max_normal();
+  float small_value = FPBits<float>::min_normal();
   auto divfunc = [](float a, float b) {
     __asm__ __volatile__("ldr  s0, %0\n\t"
                          "ldr  s1, %1\n\t"
diff --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h
index dcc56028647227..1a89de50b6b604 100644
--- a/libc/src/__support/FPUtil/arm/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h
@@ -135,8 +135,8 @@ LIBC_INLINE int set_except(int excepts) {
 LIBC_INLINE int raise_except(int excepts) {
   float zero = 0.0f;
   float one = 1.0f;
-  float large_value = float(FPBits<float>(FPBits<float>::MAX_NORMAL));
-  float small_value = float(FPBits<float>(FPBits<float>::MIN_NORMAL));
+  float large_value = FPBits<float>::max_normal();
+  float small_value = FPBits<float>::min_normal();
   auto divfunc = [](float a, float b) {
     __asm__ __volatile__("flds  s0, %0\n\t"
                          "flds  s1, %1\n\t"

``````````

</details>


https://github.com/llvm/llvm-project/pull/78590


More information about the libc-commits mailing list