From: Owen Anderson Date: Tue, 28 Dec 2021 19:44:49 +0000 (-0800) Subject: Set std::numeric_limits<>::tinyness_before to true for floating point types on ARM... X-Git-Tag: upstream/15.0.7~15632 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4745c994e4a794ca177152c4c0bd0f640d0cbe8b;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/libcxx/include/limits b/libcxx/include/limits index bf5d6d1..5afef4b 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 e132d4f..3231a63 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(); + test(); + test(); +#else test(); test(); test(); +#endif return 0; }