1 # Support for adding __float128 to the powerpc.
3 # The standard 128-bit floating point support functions are TFmode. Most
4 # PowerPC targets use a long double format that has a pair of doubles to give
5 # you more precision, but no extra expoenent range. This long double format is
6 # mostly compatible with the format used by the IBM XL compilers. Some of the
7 # names used by the IBM double-double format use TF in them, so we rename
8 # all of the functions provided for the new IEEE 128-bit support.
10 # We use the TF functions in soft-fp for 128-bit floating point support, using
11 # sed to transform the names in the files from TF names to KF names.
13 # Emulator functions from the soft-fp directory
14 fp128_softfp_funcs = addkf3 subkf3 mulkf3 divkf3 negkf2 \
15 unordkf2 eqkf2 gekf2 lekf2 \
16 extendsfkf2 extenddfkf2 trunckfsf2 trunckfdf2 \
17 fixkfsi fixkfdi fixunskfsi fixunskfdi \
18 floatsikf floatdikf floatunsikf floatundikf
20 fp128_softfp_src = $(addsuffix -sw.c,$(fp128_softfp_funcs))
21 fp128_softfp_static_obj = $(addsuffix -sw$(objext),$(fp128_softfp_funcs))
22 fp128_softfp_shared_obj = $(addsuffix -sw_s$(objext),$(fp128_softfp_funcs))
23 fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
25 # Decimal <-> _Float128 conversions
26 fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \
27 _sd_to_kf _dd_to_kf _td_to_kf
29 # Decimal <-> __ibm128 conversions
30 ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \
31 _sd_to_tf _dd_to_tf _td_to_tf
33 # New functions for software emulation
34 fp128_ppc_funcs = floattikf-sw floatuntikf-sw \
35 fixkfti-sw fixunskfti-sw \
36 extendkftf2-sw trunctfkf2-sw \
37 sfp-exceptions _mulkc3 _divkc3 _powikf2
39 ifeq ($(decimal_float),yes)
40 fp128_ppc_funcs += $(fp128_dec_funcs)
43 fp128_ppc_src = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix \
44 .c,$(fp128_ppc_funcs)))
45 fp128_ppc_static_obj = $(addsuffix $(objext),$(fp128_ppc_funcs))
46 fp128_ppc_shared_obj = $(addsuffix _s$(objext),$(fp128_ppc_funcs))
47 fp128_ppc_obj = $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj)
50 fp128_funcs = $(fp128_softfp_funcs) $(fp128_ppc_funcs) \
51 $(fp128_hw_funcs) $(fp128_ifunc_funcs) \
54 fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) \
55 $(fp128_hw_src) $(fp128_ifunc_src) \
58 fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) \
59 $(fp128_hw_obj) $(fp128_ifunc_obj) \
62 fp128_sed = $(srcdir)/config/rs6000/float128-sed$(fp128_sed_hw)
63 fp128_dep = $(fp128_sed) $(srcdir)/config/rs6000/t-float128
65 fp128_includes = $(srcdir)/soft-fp/double.h \
66 $(srcdir)/soft-fp/op-1.h \
67 $(srcdir)/soft-fp/op-4.h \
68 $(srcdir)/soft-fp/op-common.h \
69 $(srcdir)/soft-fp/single.h \
70 $(srcdir)/soft-fp/extended.h \
71 $(srcdir)/soft-fp/op-2.h \
72 $(srcdir)/soft-fp/op-8.h \
73 $(srcdir)/soft-fp/quad.h \
74 $(srcdir)/soft-fp/soft-fp.h
76 # Build the emulator without ISA 3.0 hardware support.
77 FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 \
78 -mno-float128-hardware -mno-gnu-attribute \
80 -I$(srcdir)/config/rs6000 \
83 $(fp128_softfp_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
84 $(fp128_ppc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
85 $(fp128_obj) : $(fp128_includes)
86 $(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h
88 # Force the TF mode to/from decimal functions to be compiled with IBM long
89 # double. Add building the KF mode to/from decimal conversions with explict
91 fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \
92 $(addsuffix _s$(objext),$(fp128_dec_funcs))
94 ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \
95 $(addsuffix _s$(objext),$(ibm128_dec_funcs))
97 FP128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble
98 IBM128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ibmlongdouble
100 $(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL)
101 $(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
103 $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
104 @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
106 (echo "/* file created from $$src */"; \
108 sed -f $(fp128_sed) < $$src) > $@
110 .PHONY: test clean-float128
113 @echo "fp128_src:"; \
114 for x in $(fp128_src); do echo " $$x"; done; \
117 for x in $(fp128_obj); do echo " $$x"; done;
120 -rm -f $(fp128_softfp_src) $(fp128_hardfp_src)
121 @$(MULTICLEAN) multi-clean DO=clean-float128
123 # For now, only put it in the static library
124 # LIB2ADD += $(fp128_src)
126 LIB2ADD_ST += $(fp128_src)