[libcxx-commits] [libcxx] 4745c99 - Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Owen Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 22 15:49:26 PST 2022


Author: Owen Anderson
Date: 2022-02-22T15:49:21-08:00
New Revision: 4745c994e4a794ca177152c4c0bd0f640d0cbe8b

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

LOG: Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM platforms.

Section E1.3.5 in the ARMv8 Architecture Reference Manual specifies:
  Underflow. The bit is set to 1 if the absolute value of the result
  of an operation, produced before rounding, is less than the minimum
  positive normalized number for the destination precision, and the
  rounded result is inexact.

Reviewed By: #libc, majnemer, EricWF

Differential Revision: https://reviews.llvm.org/D116338

Added: 
    

Modified: 
    libcxx/include/limits
    libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/limits b/libcxx/include/limits
index bf5d6d1fc4e71..5afef4bd7e064 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -339,7 +339,11 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_modulo = false;
 
     static _LIBCPP_CONSTEXPR const bool traps = false;
+#if (defined(__arm__) || defined(__aarch64__))
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+#else
     static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+#endif
     static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
 };
 
@@ -385,7 +389,11 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_modulo = false;
 
     static _LIBCPP_CONSTEXPR const bool traps = false;
+#if (defined(__arm__) || defined(__aarch64__))
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+#else
     static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+#endif
     static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
 };
 
@@ -435,7 +443,11 @@ protected:
     static _LIBCPP_CONSTEXPR const bool is_modulo = false;
 
     static _LIBCPP_CONSTEXPR const bool traps = false;
+#if (defined(__arm__) || defined(__aarch64__))
+    static _LIBCPP_CONSTEXPR const bool tinyness_before = true;
+#else
     static _LIBCPP_CONSTEXPR const bool tinyness_before = false;
+#endif
     static _LIBCPP_CONSTEXPR const float_round_style round_style = round_to_nearest;
 };
 

diff  --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
index e132d4fc1449b..3231a63a54bde 100644
--- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp
@@ -50,9 +50,15 @@ int main(int, char**)
     test<__int128_t, false>();
     test<__uint128_t, false>();
 #endif
+#if (defined(__arm__) || defined(__aarch64__))
+    test<float, true>();
+    test<double, true>();
+    test<long double, true>();
+#else
     test<float, false>();
     test<double, false>();
     test<long double, false>();
+#endif
 
   return 0;
 }


        


More information about the libcxx-commits mailing list