gcc/libgcc/config/rs6000/t-float128
Michael Meissner 6a8886e45f re PR target/85358 (PowerPC: Using -mabi=ieeelongdouble -mcpu=power9 breaks __ibm128)
[gcc]
2018-06-18  Michael Meissner  <meissner@linux.ibm.com>

	PR target/85358
	* config/rs6000/rs6000-modes.def (toplevel): Rework the 128-bit
	floating point modes, so that IFmode is numerically greater than
	TFmode, which is greater than KFmode using FRACTIONAL_FLOAT_MODE
	to declare the ordering.  This prevents IFmode from being
	converted to TFmode when long double is IEEE 128-bit on an ISA 3.0
	machine.  Include rs6000-modes.h to share the fractional values
	between genmodes* and the rest of the compiler.
	(IFmode): Likewise.
	(KFmode): Likewise.
	(TFmode): Likewise.
	* config/rs6000/rs6000-modes.h: New file.
	* config/rs6000/rs6000.c (rs6000_debug_reg_global): Change the
	meaning of rs6000_long_double_size so that 126..128 selects an
	appropriate 128-bit floating point type.
	(rs6000_option_override_internal): Likewise.
	* config/rs6000/rs6000.h (toplevel): Include rs6000-modes.h.
	(TARGET_LONG_DOUBLE_128): Change the meaning of
	rs6000_long_double_size so that 126..128 selects an appropriate
	128-bit floating point type.
	(LONG_DOUBLE_TYPE_SIZE): Update comment.
	* config/rs6000/rs6000.md (trunciftf2): Correct the modes of the
	source and destination to match the standard usage.
	(truncifkf2): Likewise.
	(copysign<mode>3, IEEE iterator): Rework copysign of float128 on
	ISA 2.07 to use an explicit clobber, instead of passing in a
	temporary.
	(copysign<mode>3_soft): Likewise.

[libgcc]
2018-06-18  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/t-float128 (FP128_CFLAGS_SW): Compile float128
	support modules with -mno-gnu-attribute.
	* config/rs6000/t-float128-hw (FP128_CFLAGS_HW): Likewise.

From-SVN: r261712
2018-06-18 19:10:08 +00:00

96 lines
3.5 KiB
Plaintext

# Support for adding __float128 to the powerpc.
# The standard 128-bit floating point support functions are TFmode. Most
# PowerPC targets use a long double format that has a pair of doubles to give
# you more precision, but no extra expoenent range. This long double format is
# mostly compatible with the format used by the IBM XL compilers. Some of the
# names used by the IBM double-double format use TF in them, so we rename
# all of the functions provided for the new IEEE 128-bit support.
#
# We use the TF functions in soft-fp for 128-bit floating point support, using
# sed to transform the names in the files from TF names to KF names.
# Emulator functions from the soft-fp directory
fp128_softfp_funcs = addkf3 subkf3 mulkf3 divkf3 negkf2 \
unordkf2 eqkf2 gekf2 lekf2 \
extendsfkf2 extenddfkf2 trunckfsf2 trunckfdf2 \
fixkfsi fixkfdi fixunskfsi fixunskfdi \
floatsikf floatdikf floatunsikf floatundikf
fp128_softfp_src = $(addsuffix -sw.c,$(fp128_softfp_funcs))
fp128_softfp_static_obj = $(addsuffix -sw$(objext),$(fp128_softfp_funcs))
fp128_softfp_shared_obj = $(addsuffix -sw_s$(objext),$(fp128_softfp_funcs))
fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
# New functions for software emulation
fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \
extendkftf2-sw trunctfkf2-sw \
sfp-exceptions _mulkc3 _divkc3 _powikf2
fp128_ppc_src = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix \
.c,$(fp128_ppc_funcs)))
fp128_ppc_static_obj = $(addsuffix $(objext),$(fp128_ppc_funcs))
fp128_ppc_shared_obj = $(addsuffix _s$(objext),$(fp128_ppc_funcs))
fp128_ppc_obj = $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj)
# All functions
fp128_funcs = $(fp128_softfp_funcs) $(fp128_ppc_funcs) \
$(fp128_hw_funcs) $(fp128_ifunc_funcs)
fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) \
$(fp128_hw_src) $(fp128_ifunc_src)
fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) \
$(fp128_hw_obj) $(fp128_ifunc_obj)
fp128_sed = $(srcdir)/config/rs6000/float128-sed$(fp128_sed_hw)
fp128_dep = $(fp128_sed) $(srcdir)/config/rs6000/t-float128
fp128_includes = $(srcdir)/soft-fp/double.h \
$(srcdir)/soft-fp/op-1.h \
$(srcdir)/soft-fp/op-4.h \
$(srcdir)/soft-fp/op-common.h \
$(srcdir)/soft-fp/single.h \
$(srcdir)/soft-fp/extended.h \
$(srcdir)/soft-fp/op-2.h \
$(srcdir)/soft-fp/op-8.h \
$(srcdir)/soft-fp/quad.h \
$(srcdir)/soft-fp/soft-fp.h
# Build the emulator without ISA 3.0 hardware support.
FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 \
-mno-float128-hardware -mno-gnu-attribute \
-I$(srcdir)/soft-fp \
-I$(srcdir)/config/rs6000 \
$(FLOAT128_HW_INSNS)
$(fp128_softfp_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
$(fp128_ppc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
$(fp128_obj) : $(fp128_includes)
$(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h
$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
@src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
echo "Create $@"; \
(echo "/* file created from $$src */"; \
echo; \
sed -f $(fp128_sed) < $$src) > $@
.PHONY: test clean-float128
test:
@echo "fp128_src:"; \
for x in $(fp128_src); do echo " $$x"; done; \
echo; \
echo "fp128_obj:"; \
for x in $(fp128_obj); do echo " $$x"; done;
clean-float128:
-rm -f $(fp128_softfp_src) $(fp128_hardfp_src)
@$(MULTICLEAN) multi-clean DO=clean-float128
# For now, only put it in the static library
# LIB2ADD += $(fp128_src)
LIB2ADD_ST += $(fp128_src)