[libc-commits] [libc] be8b2d1 - Add explicit conversion to fix arm64 builds. (#82429)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 20 14:52:11 PST 2024


Author: Moshe
Date: 2024-02-20T16:52:07-06:00
New Revision: be8b2d1ea54f964603b89ab9d4dfad26afebb347

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

LOG: Add explicit conversion to fix arm64 builds. (#82429)

Fixes issue preventing builds on ARM-based Macs.

https://github.com/llvm/llvm-project/issues/82205.

Co-authored-by: Moshe Berman <mosheberman at users.noreply.github.com>

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index ea1fd68a5fcdfc..fd915373020ec9 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 = FPBits<float>::max_normal();
-  float small_value = FPBits<float>::min_normal();
+  float large_value = FPBits<float>::max_normal().get_val();
+  float small_value = FPBits<float>::min_normal().get_val();
   auto divfunc = [](float a, float b) {
     __asm__ __volatile__("ldr  s0, %0\n\t"
                          "ldr  s1, %1\n\t"
@@ -277,8 +277,8 @@ LIBC_INLINE int set_env(const fenv_t *envp) {
     return 0;
   }
   const FEnv::FPState *state = reinterpret_cast<const FEnv::FPState *>(envp);
-  FEnv::set_control_word(state->ControlWord);
-  FEnv::set_status_word(state->StatusWord);
+  FEnv::set_control_word(static_cast<uint32_t>(state->ControlWord));
+  FEnv::set_status_word(static_cast<uint32_t>(state->StatusWord));
   return 0;
 }
 


        


More information about the libc-commits mailing list