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

via libc-commits libc-commits at lists.llvm.org
Fri Jan 19 00:34:32 PST 2024


Author: Guillaume Chatelet
Date: 2024-01-19T09:34:28+01:00
New Revision: 28d64c1237c28c0341700441eb2f275457f29e6a

URL: https://github.com/llvm/llvm-project/commit/28d64c1237c28c0341700441eb2f275457f29e6a
DIFF: https://github.com/llvm/llvm-project/commit/28d64c1237c28c0341700441eb2f275457f29e6a.diff

LOG: [libc][NFC] Simplify FPBits expressions (#78590)

Added: 
    

Modified: 
    libc/src/__support/FPUtil/aarch64/FEnvImpl.h
    libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
    libc/src/__support/FPUtil/arm/FEnvImpl.h

Removed: 
    


################################################################################
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"


        


More information about the libc-commits mailing list