1 /* US Software GOFAST floating point library support. 2 Copyright (C) 1994, 1998, 1999, 2002 Free Software Foundation, Inc. 3 4 This file is part of GNU CC. 5 6 GNU CC 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. 10 11 GNU CC 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. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU CC; see the file COPYING. If not, write to 18 the Free Software Foundation, 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 20 21 /* This is used by fp-bit.c. */ 22 #define US_SOFTWARE_GOFAST 23 24 /* The US Software GOFAST library requires special optabs support. 25 There is no negation libcall, and several others have names different 26 from gcc. This file consolidates the support in one place. 27 28 The basic plan is to leave gcc proper alone and via some hook fix things 29 after the optabs have been set up. Our main entry point is 30 INIT_GOFAST_OPTABS. */ 31 32 #define INIT_GOFAST_OPTABS \ 33 do { \ 34 GOFAST_CLEAR_NEG_FLOAT_OPTAB; \ 35 GOFAST_RENAME_LIBCALLS; \ 36 } while (0) 37 38 #define GOFAST_CLEAR_NEG_FLOAT_OPTAB \ 39 do { \ 40 int mode; \ 41 for (mode = SFmode; (int) mode <= (int) TFmode; \ 42 mode = (enum machine_mode) ((int) mode + 1)) \ 43 neg_optab->handlers[(int) mode].libfunc = NULL_RTX; \ 44 } while (0) 45 46 /* GCC does not use fpcmp/dpcmp for gt or ge because its own 47 FP-emulation library returns +1 for both > and unord. So we leave 48 gt and ge unset, such that, instead of fpcmp(a,b) >[=], we generate 49 fpcmp(b,a) <[=] 0, which is unambiguous. For unord libfuncs, we 50 use our own functions, since GOFAST doesn't supply them. */ 51 #define GOFAST_RENAME_LIBCALLS \ 52 add_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpadd"); \ 53 add_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpadd"); \ 54 sub_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpsub"); \ 55 sub_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpsub"); \ 56 smul_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpmul"); \ 57 smul_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpmul"); \ 58 sdiv_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpdiv"); \ 59 sdiv_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpdiv"); \ 60 cmp_optab->handlers[(int) SFmode].libfunc = init_one_libfunc ("fpcmp"); \ 61 cmp_optab->handlers[(int) DFmode].libfunc = init_one_libfunc ("dpcmp"); \ 62 \ 63 extendsfdf2_libfunc = init_one_libfunc ("fptodp"); \ 64 truncdfsf2_libfunc = init_one_libfunc ("dptofp"); \ 65 \ 66 eqhf2_libfunc = NULL_RTX; \ 67 nehf2_libfunc = NULL_RTX; \ 68 gthf2_libfunc = NULL_RTX; \ 69 gehf2_libfunc = NULL_RTX; \ 70 lthf2_libfunc = NULL_RTX; \ 71 lehf2_libfunc = NULL_RTX; \ 72 \ 73 eqsf2_libfunc = init_one_libfunc ("fpcmp"); \ 74 nesf2_libfunc = init_one_libfunc ("fpcmp"); \ 75 gtsf2_libfunc = NULL_RTX; \ 76 gesf2_libfunc = NULL_RTX; \ 77 ltsf2_libfunc = init_one_libfunc ("fpcmp"); \ 78 lesf2_libfunc = init_one_libfunc ("fpcmp"); \ 79 \ 80 eqdf2_libfunc = init_one_libfunc ("dpcmp"); \ 81 nedf2_libfunc = init_one_libfunc ("dpcmp"); \ 82 gtdf2_libfunc = NULL_RTX; \ 83 gedf2_libfunc = NULL_RTX; \ 84 ltdf2_libfunc = init_one_libfunc ("dpcmp"); \ 85 ledf2_libfunc = init_one_libfunc ("dpcmp"); \ 86 \ 87 eqxf2_libfunc = NULL_RTX; \ 88 nexf2_libfunc = NULL_RTX; \ 89 gtxf2_libfunc = NULL_RTX; \ 90 gexf2_libfunc = NULL_RTX; \ 91 ltxf2_libfunc = NULL_RTX; \ 92 lexf2_libfunc = NULL_RTX; \ 93 \ 94 eqtf2_libfunc = NULL_RTX; \ 95 netf2_libfunc = NULL_RTX; \ 96 gttf2_libfunc = NULL_RTX; \ 97 getf2_libfunc = NULL_RTX; \ 98 lttf2_libfunc = NULL_RTX; \ 99 letf2_libfunc = NULL_RTX; \ 100 \ 101 floatsisf_libfunc = init_one_libfunc ("sitofp"); \ 102 floatsidf_libfunc = init_one_libfunc ("litodp"); \ 103 fixsfsi_libfunc = init_one_libfunc ("fptosi"); \ 104 fixdfsi_libfunc = init_one_libfunc ("dptoli"); \ 105 fixunssfsi_libfunc = init_one_libfunc ("fptoui"); \ 106 fixunsdfsi_libfunc = init_one_libfunc ("dptoul"); \ 107 108 /* End of GOFAST_RENAME_LIBCALLS */ 109