gofast.h revision 132718
1/* US Software GOFAST floating point library support. 2 Copyright (C) 1994, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. 3 4This file is part of GCC. 5 6GCC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 11GCC is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with GCC; see the file COPYING. If not, write to 18the Free Software Foundation, 59 Temple Place - Suite 330, 19Boston, MA 02111-1307, USA. */ 20 21/* The US Software GOFAST library requires special optabs support. 22 This file is intended to be included by config/ARCH/ARCH.c. It 23 defines one function, gofast_maybe_init_libfuncs, which should be 24 called from the TARGET_INIT_LIBFUNCS hook. When tm.h has defined 25 US_SOFTWARE_GOFAST, this function will adjust all the optabs and 26 libfuncs appropriately. Otherwise it will do nothing. */ 27 28static void 29gofast_maybe_init_libfuncs (void) 30{ 31#ifdef US_SOFTWARE_GOFAST 32 int mode; 33 34 set_optab_libfunc (add_optab, SFmode, "fpadd"); 35 set_optab_libfunc (add_optab, DFmode, "dpadd"); 36 set_optab_libfunc (sub_optab, SFmode, "fpsub"); 37 set_optab_libfunc (sub_optab, DFmode, "dpsub"); 38 set_optab_libfunc (smul_optab, SFmode, "fpmul"); 39 set_optab_libfunc (smul_optab, DFmode, "dpmul"); 40 set_optab_libfunc (sdiv_optab, SFmode, "fpdiv"); 41 set_optab_libfunc (sdiv_optab, DFmode, "dpdiv"); 42 set_optab_libfunc (cmp_optab, SFmode, "fpcmp"); 43 set_optab_libfunc (cmp_optab, DFmode, "dpcmp"); 44 45 /* GOFAST does not provide libfuncs for negation, so we use the 46 standard names. */ 47 48 /* GCC does not use fpcmp/dpcmp for gt or ge because its own 49 FP-emulation library returns +1 for both > and unord. So we 50 leave gt and ge unset, such that, instead of fpcmp(a,b) >[=], we 51 generate fpcmp(b,a) <[=] 0, which is unambiguous. For unord 52 libfuncs, we use our own functions, since GOFAST doesn't supply 53 them. */ 54 55 set_optab_libfunc (eq_optab, SFmode, "fpcmp"); 56 set_optab_libfunc (ne_optab, SFmode, "fpcmp"); 57 set_optab_libfunc (gt_optab, SFmode, 0); 58 set_optab_libfunc (ge_optab, SFmode, 0); 59 set_optab_libfunc (lt_optab, SFmode, "fpcmp"); 60 set_optab_libfunc (le_optab, SFmode, "fpcmp"); 61 62 set_optab_libfunc (eq_optab, DFmode, "dpcmp"); 63 set_optab_libfunc (ne_optab, DFmode, "dpcmp"); 64 set_optab_libfunc (gt_optab, DFmode, 0); 65 set_optab_libfunc (ge_optab, DFmode, 0); 66 set_optab_libfunc (lt_optab, DFmode, "dpcmp"); 67 set_optab_libfunc (le_optab, DFmode, "dpcmp"); 68 69 set_conv_libfunc (sext_optab, DFmode, SFmode, "fptodp"); 70 set_conv_libfunc (trunc_optab, SFmode, DFmode, "dptofp"); 71 72 set_conv_libfunc (sfix_optab, SImode, SFmode, "fptosi"); 73 set_conv_libfunc (sfix_optab, SImode, DFmode, "dptoli"); 74 set_conv_libfunc (ufix_optab, SImode, SFmode, "fptoui"); 75 set_conv_libfunc (ufix_optab, SImode, DFmode, "dptoul"); 76 77 set_conv_libfunc (sfloat_optab, SFmode, SImode, "sitofp"); 78 set_conv_libfunc (sfloat_optab, DFmode, SImode, "litodp"); 79#endif 80} 81