Define target hook to emit KFmode constants for libgcc.

This patch defines a target hook so that the KFmode constants
(__LIBGCC_KF_MAX__, __LIBGCC_KF_MIN__, and __LIBGCC_KF_EPSILON__) needed to
build _divkc3.c in libgcc are defined.  The need for these constants were added
in the April 28th changes to libgcc that added complex division optimizations.

We only define the KFmode constants if IEEE 128-bit floating point is
supported, but long double does not use the IEEE 128-bit format.  If long
double uses the IEEE 128-bit format, it will use TFmode and not KFmode.

gcc/
2021-04-30  Michael Meissner  <meissner@linux.ibm.com>

	PR bootstrap/100327
	* config/rs6000/rs6000.c
	(TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Define.
	(rs6000_libgcc_floating_mode_supported_p): New target hook.
This commit is contained in:
Michael Meissner 2021-04-30 12:32:08 -04:00
parent 69e5544210
commit d9398dd290

View file

@ -1569,6 +1569,10 @@ static const struct attribute_spec rs6000_attribute_table[] =
#undef TARGET_SCALAR_MODE_SUPPORTED_P
#define TARGET_SCALAR_MODE_SUPPORTED_P rs6000_scalar_mode_supported_p
#undef TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
#define TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P \
rs6000_libgcc_floating_mode_supported_p
#undef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P rs6000_vector_mode_supported_p
@ -23826,6 +23830,31 @@ rs6000_scalar_mode_supported_p (scalar_mode mode)
return default_scalar_mode_supported_p (mode);
}
/* Target hook for libgcc_floating_mode_supported_p. */
static bool
rs6000_libgcc_floating_mode_supported_p (scalar_float_mode mode)
{
switch (mode)
{
case E_SFmode:
case E_DFmode:
case E_TFmode:
return true;
/* We only return true for KFmode if IEEE 128-bit types are supported, and
if long double does not use the IEEE 128-bit format. If long double
uses the IEEE 128-bit format, it will use TFmode and not KFmode.
Because the code will not use KFmode in that case, there will be aborts
because it can't find KFmode in the Floatn types. */
case E_KFmode:
return TARGET_FLOAT128_TYPE && !TARGET_IEEEQUAD;
default:
return false;
}
}
/* Target hook for vector_mode_supported_p. */
static bool
rs6000_vector_mode_supported_p (machine_mode mode)