summaryrefslogtreecommitdiff
path: root/libgcc/libgcc2.h
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.ibm.com>2023-03-06 17:38:33 -0500
committerMichael Meissner <meissner@linux.ibm.com>2023-03-06 17:38:33 -0500
commit306c7b1ac3e4413288e6930b00a3cab2133c4e57 (patch)
tree7627d63c250b4abec9f4500818a35b0fd57997fb /libgcc/libgcc2.h
parent553ff2524f412be4e02e2ffb1a0a3dc3e2280742 (diff)
downloadgcc-306c7b1ac3e4413288e6930b00a3cab2133c4e57.tar.gz
PR target/107299: Fix build issue when long double is IEEE 128-bit
This patch updates the IEEE 128-bit types used in libgcc. At the moment, we cannot build GCC when the target uses IEEE 128-bit long doubles, such as building the compiler for a native Fedora 36 system. The build dies when it is trying to build the _mulkc3.c and _divkc3 modules. This patch changes libgcc to use long double for the IEEE 128-bit base type if long double is IEEE 128-bit, and it uses _Float128 otherwise. The built-in functions are adjusted to be the correct version based on the IEEE 128-bit base type used. While it is desirable to ultimately have __float128 and _Float128 use the same internal type and mode within GCC, at present if you use the option -mabi=ieeelongdouble, the __float128 type will use the long double type and not the _Float128 type. We get an internal compiler error if we combine the signbitf128 built-in with a long double type. I've gone through several iterations of trying to fix this within GCC, and there are various problems that have come up. I developed this alternative patch that changes libgcc so that it does not tickle the issue. I hope we can fix the compiler at some point, but right now, this is preventing people on Fedora 36 systems from building compilers where the default long double is IEEE 128-bit. 2023-03-06 Michael Meissner <meissner@linux.ibm.com> libgcc/ PR target/107299 * config/rs6000/_divkc3.c (COPYSIGN): Use the correct built-in based on whether long double is IBM or IEEE. (INFINITY): Likewise. (FABS): Likewise. * config/rs6000/_mulkc3.c (COPYSIGN): Likewise. (INFINITY): Likewise. * config/rs6000/quad-float128.h (TF): Remove definition. (TFtype): Define to be long double or _Float128. (TCtype): Define to be _Complex long double or _Complex _Float128. * libgcc2.h (TFtype): Allow machine config files to override this. (TCtype): Likewise. * soft-fp/quad.h (TFtype): Likewise.
Diffstat (limited to 'libgcc/libgcc2.h')
-rw-r--r--libgcc/libgcc2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgcc/libgcc2.h b/libgcc/libgcc2.h
index 6f42db7f0be..3ec9bbd8164 100644
--- a/libgcc/libgcc2.h
+++ b/libgcc/libgcc2.h
@@ -156,9 +156,13 @@ typedef float XFtype __attribute__ ((mode (XF)));
typedef _Complex float XCtype __attribute__ ((mode (XC)));
#endif
#if LIBGCC2_HAS_TF_MODE
+#ifndef TFtype
typedef float TFtype __attribute__ ((mode (TF)));
+#endif
+#ifndef TCtype
typedef _Complex float TCtype __attribute__ ((mode (TC)));
#endif
+#endif
typedef int cmp_return_type __attribute__((mode (__libgcc_cmp_return__)));
typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));