2008-07-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[official-gcc.git] / gcc / config / gofast.h
blob69e9eddf00941996278003bc455a9fe2551fd333
1 /* US Software GOFAST floating point library support.
2 Copyright (C) 1994, 1998, 1999, 2002, 2003, 2004, 2007
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
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, SImode, "litodp");
79 #endif