1# Support for adding __float128 to the powerpc.
2
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.
9#
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.
12
13# Emulator functions from the soft-fp directory
14fp128_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
19
20fp128_softfp_src	= $(addsuffix -sw.c,$(fp128_softfp_funcs))
21fp128_softfp_static_obj	= $(addsuffix -sw$(objext),$(fp128_softfp_funcs))
22fp128_softfp_shared_obj	= $(addsuffix -sw_s$(objext),$(fp128_softfp_funcs))
23fp128_softfp_obj	= $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
24
25# New functions for software emulation
26fp128_ppc_funcs		= floattikf floatuntikf fixkfti fixunskfti \
27			  extendkftf2-sw trunctfkf2-sw \
28			  sfp-exceptions _mulkc3 _divkc3 _powikf2
29
30fp128_ppc_src		= $(addprefix $(srcdir)/config/rs6000/,$(addsuffix \
31				.c,$(fp128_ppc_funcs)))
32fp128_ppc_static_obj	= $(addsuffix $(objext),$(fp128_ppc_funcs))
33fp128_ppc_shared_obj	= $(addsuffix _s$(objext),$(fp128_ppc_funcs))
34fp128_ppc_obj		= $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj)
35
36# All functions
37fp128_funcs		= $(fp128_softfp_funcs) $(fp128_ppc_funcs) \
38			  $(fp128_hw_funcs) $(fp128_ifunc_funcs)
39
40fp128_src		= $(fp128_softfp_src) $(fp128_ppc_src) \
41			  $(fp128_hw_src) $(fp128_ifunc_src)
42
43fp128_obj		= $(fp128_softfp_obj) $(fp128_ppc_obj) \
44			  $(fp128_hw_obj) $(fp128_ifunc_obj)
45
46fp128_sed		= $(srcdir)/config/rs6000/float128-sed$(fp128_sed_hw)
47fp128_dep		= $(fp128_sed) $(srcdir)/config/rs6000/t-float128
48
49fp128_includes		= $(srcdir)/soft-fp/double.h \
50			  $(srcdir)/soft-fp/op-1.h \
51			  $(srcdir)/soft-fp/op-4.h \
52			  $(srcdir)/soft-fp/op-common.h \
53			  $(srcdir)/soft-fp/single.h \
54			  $(srcdir)/soft-fp/extended.h \
55			  $(srcdir)/soft-fp/op-2.h \
56			  $(srcdir)/soft-fp/op-8.h \
57			  $(srcdir)/soft-fp/quad.h \
58			  $(srcdir)/soft-fp/soft-fp.h
59
60# Build the emulator without ISA 3.0 hardware support.
61FP128_CFLAGS_SW		 = -Wno-type-limits -mvsx -mfloat128 \
62			   -mno-float128-hardware -mno-gnu-attribute \
63			   -I$(srcdir)/soft-fp \
64			   -I$(srcdir)/config/rs6000 \
65			   $(FLOAT128_HW_INSNS)
66
67$(fp128_softfp_obj)	 : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
68$(fp128_ppc_obj)	 : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
69$(fp128_obj)		 : $(fp128_includes)
70$(fp128_obj)		 : $(srcdir)/config/rs6000/quad-float128.h
71
72$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
73	@src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
74	echo "Create $@"; \
75	(echo "/* file created from $$src */"; \
76	 echo; \
77	 sed -f $(fp128_sed) < $$src) > $@
78
79.PHONY: test clean-float128
80
81test:
82	@echo "fp128_src:"; \
83	for x in $(fp128_src); do echo "    $$x"; done; \
84	echo; \
85	echo "fp128_obj:"; \
86	for x in $(fp128_obj); do echo "    $$x"; done;
87
88clean-float128:
89	-rm -f $(fp128_softfp_src) $(fp128_hardfp_src)
90	@$(MULTICLEAN) multi-clean DO=clean-float128
91
92# For now, only put it in the static library
93# LIB2ADD += $(fp128_src)
94
95LIB2ADD_ST += $(fp128_src)
96