]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/gofast.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / gofast.h
1 /* US Software GOFAST floating point library support.
2    Copyright (C) 1994, 1998, 1999, 2002, 2003, 2004
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
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 2, or (at your option)
10 any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.  */
21
22 /* The US Software GOFAST library requires special optabs support.
23    This file is intended to be included by config/ARCH/ARCH.c.  It
24    defines one function, gofast_maybe_init_libfuncs, which should be
25    called from the TARGET_INIT_LIBFUNCS hook.  When tm.h has defined
26    US_SOFTWARE_GOFAST, this function will adjust all the optabs and
27    libfuncs appropriately.  Otherwise it will do nothing.  */
28
29 static void
30 gofast_maybe_init_libfuncs (void)
31 {
32 #ifdef US_SOFTWARE_GOFAST
33   int mode;
34
35   set_optab_libfunc (add_optab, SFmode, "fpadd");
36   set_optab_libfunc (add_optab, DFmode, "dpadd");
37   set_optab_libfunc (sub_optab, SFmode, "fpsub");
38   set_optab_libfunc (sub_optab, DFmode, "dpsub");
39   set_optab_libfunc (smul_optab, SFmode, "fpmul");
40   set_optab_libfunc (smul_optab, DFmode, "dpmul");
41   set_optab_libfunc (sdiv_optab, SFmode, "fpdiv");
42   set_optab_libfunc (sdiv_optab, DFmode, "dpdiv");
43   set_optab_libfunc (cmp_optab, SFmode, "fpcmp");
44   set_optab_libfunc (cmp_optab, DFmode, "dpcmp");
45
46   /* GOFAST does not provide libfuncs for negation, so we use the
47      standard names.  */
48
49   /* GCC does not use fpcmp/dpcmp for gt or ge because its own
50      FP-emulation library returns +1 for both > and unord.  So we
51      leave gt and ge unset, such that, instead of fpcmp(a,b) >[=], we
52      generate fpcmp(b,a) <[=] 0, which is unambiguous.  For unord
53      libfuncs, we use our own functions, since GOFAST doesn't supply
54      them.  */
55
56   set_optab_libfunc (eq_optab, SFmode, "fpcmp");
57   set_optab_libfunc (ne_optab, SFmode, "fpcmp");
58   set_optab_libfunc (gt_optab, SFmode, 0);
59   set_optab_libfunc (ge_optab, SFmode, 0);
60   set_optab_libfunc (lt_optab, SFmode, "fpcmp");
61   set_optab_libfunc (le_optab, SFmode, "fpcmp");
62
63   set_optab_libfunc (eq_optab, DFmode, "dpcmp");
64   set_optab_libfunc (ne_optab, DFmode, "dpcmp");
65   set_optab_libfunc (gt_optab, DFmode, 0);
66   set_optab_libfunc (ge_optab, DFmode, 0);
67   set_optab_libfunc (lt_optab, DFmode, "dpcmp");
68   set_optab_libfunc (le_optab, DFmode, "dpcmp");
69
70   set_conv_libfunc (sext_optab,   DFmode, SFmode, "fptodp");
71   set_conv_libfunc (trunc_optab,  SFmode, DFmode, "dptofp");
72
73   set_conv_libfunc (sfix_optab,   SImode, SFmode, "fptosi");
74   set_conv_libfunc (sfix_optab,   SImode, DFmode, "dptoli");
75   set_conv_libfunc (ufix_optab,   SImode, SFmode, "fptoui");
76   set_conv_libfunc (ufix_optab,   SImode, DFmode, "dptoul");
77
78   set_conv_libfunc (sfloat_optab, SFmode, SImode, "sitofp");
79   set_conv_libfunc (sfloat_optab, DFmode, SImode, "litodp");
80 #endif
81 }