1/* $NetBSD: softfloat-for-gcc.h,v 1.12 2013/08/01 23:21:19 matt Exp $ */ 2/*- 3 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to The NetBSD Foundation 7 * by 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* 32 * Move private identifiers with external linkage into implementation 33 * namespace. -- Klaus Klein <kleink@NetBSD.org>, May 5, 1999 34 */ 35#define float_exception_flags _softfloat_float_exception_flags 36#define float_exception_mask _softfloat_float_exception_mask 37#define float_rounding_mode _softfloat_float_rounding_mode 38#define float_raise _softfloat_float_raise 39 40/* The following batch are called by GCC through wrappers */ 41#define float32_eq _softfloat_float32_eq 42#define float32_le _softfloat_float32_le 43#define float32_lt _softfloat_float32_lt 44#define float64_eq _softfloat_float64_eq 45#define float64_le _softfloat_float64_le 46#define float64_lt _softfloat_float64_lt 47#define float128_eq _softfloat_float128_eq 48#define float128_le _softfloat_float128_le 49#define float128_lt _softfloat_float128_lt 50 51/* 52 * Macros to define functions with the GCC expected names 53 */ 54 55#define float32_add __addsf3 56#define float64_add __adddf3 57#define floatx80_add __addxf3 58#define float128_add __addtf3 59 60#define float32_sub __subsf3 61#define float64_sub __subdf3 62#define floatx80_sub __subxf3 63#define float128_sub __subtf3 64 65#define float32_mul __mulsf3 66#define float64_mul __muldf3 67#define floatx80_mul __mulxf3 68#define float128_mul __multf3 69 70#define float32_div __divsf3 71#define float64_div __divdf3 72#define floatx80_div __divxf3 73#define float128_div __divtf3 74 75#if 0 76#define float32_neg __negsf2 77#define float64_neg __negdf2 78#define floatx80_neg __negxf2 79#define float128_neg __negtf2 80#endif 81 82#define int32_to_float32 __floatsisf 83#define int32_to_float64 __floatsidf 84#define int32_to_floatx80 __floatsixf 85#define int32_to_float128 __floatsitf 86 87#define int64_to_float32 __floatdisf 88#define int64_to_float64 __floatdidf 89#define int64_to_floatx80 __floatdixf 90#define int64_to_float128 __floatditf 91 92#define int128_to_float32 __floattisf 93#define int128_to_float64 __floattidf 94#define int128_to_floatx80 __floattixf 95#define int128_to_float128 __floattitf 96 97#define uint32_to_float32 __floatunsisf 98#define uint32_to_float64 __floatunsidf 99#define uint32_to_floatx80 __floatunsixf 100#define uint32_to_float128 __floatunsitf 101 102#define uint64_to_float32 __floatundisf 103#define uint64_to_float64 __floatundidf 104#define uint64_to_floatx80 __floatundixf 105#define uint64_to_float128 __floatunditf 106 107#define uint128_to_float32 __floatuntisf 108#define uint128_to_float64 __floatuntidf 109#define uint128_to_floatx80 __floatuntixf 110#define uint128_to_float128 __floatuntitf 111 112#define float32_to_int32_round_to_zero __fixsfsi 113#define float64_to_int32_round_to_zero __fixdfsi 114#define floatx80_to_int32_round_to_zero __fixxfsi 115#define float128_to_int32_round_to_zero __fixtfsi 116 117#define float32_to_int64_round_to_zero __fixsfdi 118#define float64_to_int64_round_to_zero __fixdfdi 119#define floatx80_to_int64_round_to_zero __fixxfdi 120#define float128_to_int64_round_to_zero __fixtfdi 121 122#define float32_to_int128_round_to_zero __fixsfti 123#define float64_to_int128_round_to_zero __fixdfti 124#define floatx80_to_int128_round_to_zero __fixxfti 125#define float128_to_int128_round_to_zero __fixtfti 126 127#define float32_to_uint32_round_to_zero __fixunssfsi 128#define float64_to_uint32_round_to_zero __fixunsdfsi 129#define floatx80_to_uint32_round_to_zero __fixunsxfsi 130#define float128_to_uint32_round_to_zero __fixunstfsi 131 132#define float32_to_uint64_round_to_zero __fixunssfdi 133#define float64_to_uint64_round_to_zero __fixunsdfdi 134#define floatx80_to_uint64_round_to_zero __fixunsxfdi 135#define float128_to_uint64_round_to_zero __fixunstfdi 136 137#define float32_to_uint128_round_to_zero __fixunssfti 138#define float64_to_uint128_round_to_zero __fixunsdfti 139#define floatx80_to_uint128_round_to_zero __fixunsxfti 140#define float128_to_uint128_round_to_zero __fixunstfti 141 142#define float32_to_float64 __extendsfdf2 143#define float32_to_floatx80 __extendsfxf2 144#define float32_to_float128 __extendsftf2 145#define float64_to_floatx80 __extenddfxf2 146#define float64_to_float128 __extenddftf2 147 148#define float128_to_float64 __trunctfdf2 149#define floatx80_to_float64 __truncxfdf2 150#define float128_to_float32 __trunctfsf2 151#define floatx80_to_float32 __truncxfsf2 152#define float64_to_float32 __truncdfsf2 153 154#if 0 155#define float32_cmp __cmpsf2 156#define float32_unord __unordsf2 157#define float32_eq __eqsf2 158#define float32_ne __nesf2 159#define float32_ge __gesf2 160#define float32_lt __ltsf2 161#define float32_le __lesf2 162#define float32_gt __gtsf2 163#endif 164 165#if 0 166#define float64_cmp __cmpdf2 167#define float64_unord __unorddf2 168#define float64_eq __eqdf2 169#define float64_ne __nedf2 170#define float64_ge __gedf2 171#define float64_lt __ltdf2 172#define float64_le __ledf2 173#define float64_gt __gtdf2 174#endif 175 176/* XXX not in libgcc */ 177#if 1 178#define floatx80_cmp __cmpxf2 179#define floatx80_unord __unordxf2 180#define floatx80_eq __eqxf2 181#define floatx80_ne __nexf2 182#define floatx80_ge __gexf2 183#define floatx80_lt __ltxf2 184#define floatx80_le __lexf2 185#define floatx80_gt __gtxf2 186#endif 187 188#if 0 189#define float128_cmp __cmptf2 190#define float128_unord __unordtf2 191#define float128_eq __eqtf2 192#define float128_ne __netf2 193#define float128_ge __getf2 194#define float128_lt __lttf2 195#define float128_le __letf2 196#define float128_gt __gttf2 197#endif 198 199#ifdef __ARM_EABI__ 200#ifdef __ARM_PCS_VFP 201#include <arm/aeabi.h> 202#endif 203#define __addsf3 __aeabi_fadd 204#define __adddf3 __aeabi_dadd 205 206#define __subsf3 __aeabi_fsub 207#define __subdf3 __aeabi_dsub 208 209#define __mulsf3 __aeabi_fmul 210#define __muldf3 __aeabi_dmul 211 212#define __divsf3 __aeabi_fdiv 213#define __divdf3 __aeabi_ddiv 214 215#define __floatsisf __aeabi_i2f 216#define __floatsidf __aeabi_i2d 217 218#define __floatdisf __aeabi_l2f 219#define __floatdidf __aeabi_l2d 220 221#define __floatunsisf __aeabi_ui2f 222#define __floatunsidf __aeabi_ui2d 223 224#define __floatundisf __aeabi_ul2f 225#define __floatundidf __aeabi_ul2d 226 227#define __fixsfsi __aeabi_f2iz 228#define __fixdfsi __aeabi_d2iz 229 230#define __fixsfdi __aeabi_f2lz 231#define __fixdfdi __aeabi_d2lz 232 233#define __fixunssfsi __aeabi_f2uiz 234#define __fixunsdfsi __aeabi_d2uiz 235 236#define __fixunssfdi __aeabi_f2ulz 237#define __fixunsdfdi __aeabi_d2ulz 238 239#define __extendsfdf2 __aeabi_f2d 240#define __truncdfsf2 __aeabi_d2f 241 242#endif /* __ARM_EABI__ */ 243