Add flakey floating-point support to the TI c80 simulator.
[external/binutils.git] / sim / common / sim-fpu.h
1 /* Simulator Floating-point support.
2    Copyright (C) 1997 Free Software Foundation, Inc.
3    Contributed by Cygnus Support.
4
5 This file is part of GDB, the GNU debugger.
6
7 This program 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 This program 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 along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21
22
23 #ifndef _SIM_FPU_H_
24 #define _SIM_FPU_H_
25
26 /* the FPU intermediate type */
27
28 typedef struct _sim_fpu {
29   double val;
30 } sim_fpu;
31
32
33 /* Arrithmetic operators */
34
35 INLINE_SIM_FPU (sim_fpu) sim_fpu_add (sim_fpu l, sim_fpu r);
36 INLINE_SIM_FPU (sim_fpu) sim_fpu_sub (sim_fpu l, sim_fpu r);
37 INLINE_SIM_FPU (sim_fpu) sim_fpu_mul (sim_fpu l, sim_fpu r);
38 INLINE_SIM_FPU (sim_fpu) sim_fpu_div (sim_fpu l, sim_fpu r);
39 INLINE_SIM_FPU (sim_fpu) sim_fpu_inv (sim_fpu l);
40 INLINE_SIM_FPU (sim_fpu) sim_fpu_sqrt (sim_fpu sqr);
41
42
43 /* Conversions single/double to/from fpu type */
44
45 INLINE_SIM_FPU (sim_fpu) sim_fpu_32to (unsigned32 s);
46 INLINE_SIM_FPU (sim_fpu) sim_fpu_64to (unsigned64 s);
47
48 INLINE_SIM_FPU (unsigned32) sim_fpu_to32 (sim_fpu s);
49 INLINE_SIM_FPU (unsigned64) sim_fpu_to64 (sim_fpu s);
50
51 INLINE_SIM_FPU (float) sim_fpu_2f (sim_fpu f);
52 INLINE_SIM_FPU (double) sim_fpu_2d (sim_fpu d);
53
54 INLINE_SIM_FPU (sim_fpu) sim_fpu_f2 (float f);
55 INLINE_SIM_FPU (sim_fpu) sim_fpu_d2 (double d);
56
57
58 /* Signalling or NonSignalling NaN */
59
60 INLINE_SIM_FPU (int) sim_fpu_is_nan (sim_fpu s);
61
62
63 /* compare l with r; return <0, ==0, >0 accordingly */
64
65 INLINE_SIM_FPU (int) sim_fpu_cmp (sim_fpu l, sim_fpu r);
66
67
68 #endif