0003-libquadmath-Fix-up-libquadmath-math-sqrtq.c-compilat.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From ba9356565695728ce0c852f7de3de27f8745611d Mon Sep 17 00:00:00 2001
  2. From: Jakub Jelinek <jakub@redhat.com>
  3. Date: Sat, 3 Aug 2024 20:37:54 +0200
  4. Subject: [PATCH] libquadmath: Fix up libquadmath/math/sqrtq.c compilation in
  5. some powerpc* configurations [PR116007]
  6. My PR114623 change started using soft-fp.h and quad.h for the sqrtq implementation.
  7. Unfortunately, that seems to fail building in some powerpc* configurations, where
  8. TFmode isn't available.
  9. quad.h has:
  10. #ifndef TFtype
  11. typedef float TFtype __attribute__ ((mode (TF)));
  12. #endif
  13. and uses TFtype. quad.h has:
  14. /* Define the complex type corresponding to __float128
  15. ("_Complex __float128" is not allowed) */
  16. #if (!defined(_ARCH_PPC)) || defined(__LONG_DOUBLE_IEEE128__)
  17. typedef _Complex float __attribute__((mode(TC))) __complex128;
  18. #else
  19. typedef _Complex float __attribute__((mode(KC))) __complex128;
  20. #endif
  21. with the conditional and KCmode use added during porting of libquadmath
  22. to powerpc*, so I've just defined TFtype for powerpc when __LONG_DOUBLE_IEEE128__
  23. isn't defined; I could define it to float __attribute__ ((mode (KF))) but it
  24. seemed easier to just define it to __float128 which should do the same thing.
  25. 2024-08-03 Jakub Jelinek <jakub@redhat.com>
  26. PR target/116007
  27. * math/sqrtq.c (TFtype): For PowerPC without __LONG_DOUBLE_IEEE128__
  28. define to __float128 before including soft-fp.h and quad.h.
  29. (cherry picked from commit 3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b)
  30. Upstream: https://gcc.gnu.org/g:3ac02e67503ccffa3dfeeffc0a60fce6bdaca43b
  31. Upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007
  32. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  33. ---
  34. libquadmath/math/sqrtq.c | 3 +++
  35. 1 file changed, 3 insertions(+)
  36. diff --git a/libquadmath/math/sqrtq.c b/libquadmath/math/sqrtq.c
  37. index 8ca2828d42c..a58998a0667 100644
  38. --- a/libquadmath/math/sqrtq.c
  39. +++ b/libquadmath/math/sqrtq.c
  40. @@ -9,6 +9,9 @@
  41. && defined(FE_TOWARDZERO) \
  42. && defined(FE_INEXACT)
  43. #define USE_SOFT_FP 1
  44. +#if defined(_ARCH_PPC) && !defined(__LONG_DOUBLE_IEEE128__)
  45. +#define TFtype __float128
  46. +#endif
  47. #include "../../libgcc/soft-fp/soft-fp.h"
  48. #include "../../libgcc/soft-fp/quad.h"
  49. #endif
  50. --
  51. 2.46.0