1 /* Simulator Floating-point support.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
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)
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.
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. */
32 INLINE_SIM_FPU (sim_fpu)
33 sim_fpu_add (sim_fpu l,
37 ans.val = l.val + r.val;
42 INLINE_SIM_FPU (sim_fpu)
43 sim_fpu_sub (sim_fpu l,
47 ans.val = l.val - r.val;
52 INLINE_SIM_FPU (sim_fpu)
53 sim_fpu_mul (sim_fpu l,
57 ans.val = l.val * r.val;
62 INLINE_SIM_FPU (sim_fpu)
63 sim_fpu_div (sim_fpu l,
67 ans.val = l.val / r.val;
72 INLINE_SIM_FPU (sim_fpu)
73 sim_fpu_inv (sim_fpu r)
81 INLINE_SIM_FPU (sim_fpu)
82 sim_fpu_sqrt (sim_fpu r)
85 ans.val = sqrt (r.val);
90 INLINE_SIM_FPU (sim_fpu)
91 sim_fpu_32to (unsigned32 s)
94 ans.val = *(float*) &s;
99 INLINE_SIM_FPU (sim_fpu)
100 sim_fpu_64to (unsigned64 s)
103 ans.val = *(double*) &s;
108 INLINE_SIM_FPU (unsigned32)
109 sim_fpu_to32 (sim_fpu l)
112 return *(unsigned32*) &s;
116 INLINE_SIM_FPU (unsigned64)
117 sim_fpu_to64 (sim_fpu s)
119 return *(unsigned64*) &s.val;
123 INLINE_SIM_FPU (float)
124 sim_fpu_2f (sim_fpu f)
130 INLINE_SIM_FPU (double)
131 sim_fpu_2d (sim_fpu s)
137 INLINE_SIM_FPU (sim_fpu)
146 INLINE_SIM_FPU (sim_fpu)
147 sim_fpu_d2 (double d)
156 sim_fpu_is_nan (sim_fpu d)
158 return 0; /* FIXME - detect NaN */
163 sim_fpu_cmp (sim_fpu l,
166 return l.val - r.val;