gcc/libgcc/config/rs6000/t-float128
Carl Love 9090f48071 Conversions between 128-bit integer and floating point values.
The files fixkfti-sw.c and fixunskfti-sw.c are renamed versions of
fixkfti.c and fixunskfti.c respectively to do the conversions in software.
The function names in the files were updated with the rename as well as
some white spaces fixes. The file float128-p10.c contains the functions
for using the ISA 3.1 hardware instructions to perform the conversions.

2021-06-08  Carl Love  <cel@us.ibm.com>

gcc/ChangeLog

	* config/rs6000/rs6000.c (__fixkfti, __fixunskfti, __floattikf,
	__floatuntikf): Names changed to __fixkfti_sw, __fixunskfti_sw,
	__floattikf_sw, __floatuntikf_sw respectively.
	* config/rs6000/rs6000.md (floatti<mode>2, floatunsti<mode>2,
	fix_trunc<mode>ti2, fixuns_trunc<mode>ti2): Add
	define_insn for mode IEEE 128.

gcc/testsuite/ChangeLog

	* gcc.target/powerpc/fp128_conversions.c: New file.
	* gcc.target/powerpc/int_128bit-runnable.c(vextsd2q,
	vcmpuq, vcmpsq, vcmpequq, vcmpequq., vcmpgtsq, vcmpgtsq.
	vcmpgtuq, vcmpgtuq.): Update scan-assembler-times.
	(ppc_native_128bit): Remove dg-require-effective-target.

libgcc/ChangeLog

	* config.host: Add if test and set for
	libgcc_cv_powerpc_3_1_float128_hw.
	* config/rs6000/fixkfti.c: Renamed to fixkfti-sw.c.
	Change calls of __fixkfti to __fixkfti_sw.
	* config/rs6000/fixunskfti.c: Renamed to fixunskfti-sw.c.
	Change calls of __fixunskfti to __fixunskfti_sw.
	* config/rs6000/float128-p10.c (__floattikf_hw,
	__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw): New file.
	* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): New macro.
	(__floattikf_resolve, __floatuntikf_resolve, __fixkfti_resolve,
	__fixunskfti_resolve): Add resolve functions.
	(__floattikf, __floatuntikf, __fixkfti, __fixunskfti): New functions.
	* config/rs6000/float128-sed (floattitf, __floatuntitf,
	__fixtfti, __fixunstfti): Add editor commands to change names.
	* config/rs6000/float128-sed-hw (__floattitf,
	__floatuntitf, __fixtfti, __fixunstfti): Add editor commands to
	change names.
	* config/rs6000/floattikf.c: Renamed to floattikf-sw.c.
	* config/rs6000/floatuntikf.c: Renamed to floatuntikf-sw.c.
	* config/rs6000/quad-float128.h (__floattikf_sw,
	__floatuntikf_sw, __fixkfti_sw, __fixunskfti_sw, __floattikf_hw,
	__floatuntikf_hw, __fixkfti_hw, __fixunskfti_hw, __floattikf,
	__floatuntikf, __fixkfti, __fixunskfti): New extern declarations.
	* config/rs6000/t-float128 (floattikf, floatuntikf,
	fixkfti, fixunskfti): Remove file names from fp128_ppc_funcs.
	(floattikf-sw, floatuntikf-sw, fixkfti-sw, fixunskfti-sw): Add
	file names to fp128_ppc_funcs.
	* config/rs6000/t-float128-hw(fp128_3_1_hw_funcs,
	fp128_3_1_hw_src, fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj,
	fp128_3_1_hw_obj): Add variables for ISA 3.1 support.
	* config/rs6000/t-float128-p10-hw: New file.
	* configure: Update script for isa 3.1 128-bit float support.
	* configure.ac: Add check for 128-bit float hardware support.
2021-06-09 11:20:07 -05:00

127 lines
4.6 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)
# Decimal <-> _Float128 conversions
fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \
_sd_to_kf _dd_to_kf _td_to_kf
# Decimal <-> __ibm128 conversions
ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \
_sd_to_tf _dd_to_tf _td_to_tf
# New functions for software emulation
fp128_ppc_funcs = floattikf-sw floatuntikf-sw \
fixkfti-sw fixunskfti-sw \
extendkftf2-sw trunctfkf2-sw \
sfp-exceptions _mulkc3 _divkc3 _powikf2
ifeq ($(decimal_float),yes)
fp128_ppc_funcs += $(fp128_dec_funcs)
endif
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_3_1_hw_funcs)
fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) \
$(fp128_hw_src) $(fp128_ifunc_src) \
$(fp128_3_1_hw_src)
fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) \
$(fp128_hw_obj) $(fp128_ifunc_obj) \
$(fp128_3_1_hw_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
# Force the TF mode to/from decimal functions to be compiled with IBM long
# double. Add building the KF mode to/from decimal conversions with explict
# IEEE long double.
fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \
$(addsuffix _s$(objext),$(fp128_dec_funcs))
ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \
$(addsuffix _s$(objext),$(ibm128_dec_funcs))
FP128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble
IBM128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ibmlongdouble
$(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL)
$(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
$(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)