t-float128 4.6 KB

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