2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / config / gofast.h
blob91b0a651566e4ce9fdc2ede76f70e8ce28275963
1 /* US Software GOFAST floating point library support.
2 Copyright (C) 1994, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
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. */
28 static void
29 gofast_maybe_init_libfuncs (void)
31 #ifdef US_SOFTWARE_GOFAST
32 int mode;
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");
45 /* GOFAST does not provide libfuncs for negation, so we use the
46 standard names. */
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. */
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");
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");
69 set_conv_libfunc (sext_optab, DFmode, SFmode, "fptodp");
70 set_conv_libfunc (trunc_optab, SFmode, DFmode, "dptofp");
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");
77 set_conv_libfunc (sfloat_optab, SFmode, SImode, "sitofp");
78 set_conv_libfunc (sfloat_optab, DFmode, DImode, "litodp");
79 #endif