https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109758

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What does the committee have to do with the GCC implementation?

I guess what we could do is:
--- libstdc++-v3/include/bits/std_abs.h 2023-01-16 11:52:16.917721774 +0100
+++ libstdc++-v3/include/bits/std_abs.h 2023-05-07 12:01:03.716627026 +0200
@@ -135,7 +135,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   __extension__ inline _GLIBCXX_CONSTEXPR
   __float128
   abs(__float128 __x)
-  { return __x < 0 ? -__x : __x; }
+  {
+#if __has_builtin(__builtin_fabsf128)
+    return  __builtin_fabsf128(__x);
+#else
+    return __x < 0 ? -__x : __x;
+#endif
+  }
 #endif

 _GLIBCXX_END_NAMESPACE_VERSION
If the builtin isn't supported, perhaps we could use bit_cast if supported to
toggle the sign bit if we know where it is, but if that isn't supported either,
there is nothing we can do, as the function needs to be constexpr.

Reply via email to