Add hppa-openbsd target
[official-gcc.git] / gcc / ada / s-vaflop.ads
blob5807ddd586eee6b60c3f28c35f95a106b3764088
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . V A X _ F L O A T _ O P E R A T I O N S --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1997-1998 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package contains runtime routines for handling the non-IEEE
36 -- floating-point formats used on the Vax and the Alpha.
38 package System.Vax_Float_Operations is
40 pragma Warnings (Off);
41 -- Suppress warnings if not on Alpha/VAX
43 type D is digits 9;
44 pragma Float_Representation (VAX_Float, D);
45 -- D Float type on Vax
47 type G is digits 15;
48 pragma Float_Representation (VAX_Float, G);
49 -- G Float type on Vax
51 type F is digits 6;
52 pragma Float_Representation (VAX_Float, F);
53 -- F Float type on Vax
55 type S is digits 6;
56 pragma Float_Representation (IEEE_Float, S);
57 -- IEEE short
59 type T is digits 15;
60 pragma Float_Representation (IEEE_Float, T);
61 -- IEEE long
63 pragma Warnings (On);
65 type Q is range -2 ** 63 .. +(2 ** 63 - 1);
66 -- 64-bit signed integer
68 --------------------------
69 -- Conversion Functions --
70 --------------------------
72 function D_To_G (X : D) return G;
73 function G_To_D (X : G) return D;
74 -- Conversions between D float and G float
76 function G_To_F (X : G) return F;
77 function F_To_G (X : F) return G;
78 -- Conversions between F float and G float
80 function F_To_S (X : F) return S;
81 function S_To_F (X : S) return F;
82 -- Conversions between F float and IEEE short
84 function G_To_T (X : G) return T;
85 function T_To_G (X : T) return G;
86 -- Conversions between G float and IEEE long
88 function F_To_Q (X : F) return Q;
89 function Q_To_F (X : Q) return F;
90 -- Conversions between F float and 64-bit integer
92 function G_To_Q (X : G) return Q;
93 function Q_To_G (X : Q) return G;
94 -- Conversions between G float and 64-bit integer
96 function T_To_D (X : T) return D;
97 -- Conversion from IEEE long to D_Float (used for literals)
99 --------------------------
100 -- Arithmetic Functions --
101 --------------------------
103 function Abs_F (X : F) return F;
104 function Abs_G (X : G) return G;
105 -- Absolute value of F/G float
107 function Add_F (X, Y : F) return F;
108 function Add_G (X, Y : G) return G;
109 -- Addition of F/G float
111 function Div_F (X, Y : F) return F;
112 function Div_G (X, Y : G) return G;
113 -- Division of F/G float
115 function Mul_F (X, Y : F) return F;
116 function Mul_G (X, Y : G) return G;
117 -- Multiplication of F/G float
119 function Neg_F (X : F) return F;
120 function Neg_G (X : G) return G;
121 -- Negation of F/G float
123 function Sub_F (X, Y : F) return F;
124 function Sub_G (X, Y : G) return G;
125 -- Subtraction of F/G float
127 --------------------------
128 -- Comparison Functions --
129 --------------------------
131 function Eq_F (X, Y : F) return Boolean;
132 function Eq_G (X, Y : G) return Boolean;
133 -- Compares for X = Y
135 function Le_F (X, Y : F) return Boolean;
136 function Le_G (X, Y : G) return Boolean;
137 -- Compares for X <= Y
139 function Lt_F (X, Y : F) return Boolean;
140 function Lt_G (X, Y : G) return Boolean;
141 -- Compares for X < Y
143 ----------------------
144 -- Debug Procedures --
145 ----------------------
147 procedure Debug_Output_D (Arg : D);
148 procedure Debug_Output_F (Arg : F);
149 procedure Debug_Output_G (Arg : G);
150 pragma Export (Ada, Debug_Output_D);
151 pragma Export (Ada, Debug_Output_F);
152 pragma Export (Ada, Debug_Output_G);
153 -- These routines output their argument in decimal string form, with
154 -- no terminating line return. They are provided for implicit use by
155 -- the pre gnat-3.12w GDB, and are retained for backwards compatibility.
157 function Debug_String_D (Arg : D) return System.Address;
158 function Debug_String_F (Arg : F) return System.Address;
159 function Debug_String_G (Arg : G) return System.Address;
160 pragma Export (Ada, Debug_String_D);
161 pragma Export (Ada, Debug_String_F);
162 pragma Export (Ada, Debug_String_G);
163 -- These routines return a decimal C string image of their argument.
164 -- They are provided for implicit use by the debugger, in response to
165 -- the special encoding used for Vax floating-point types (see Exp_Dbug
166 -- for details). They supersede the above Debug_Output_D/F/G routines
167 -- which didn't work properly with GDBTK.
169 procedure pd (Arg : D);
170 procedure pf (Arg : F);
171 procedure pg (Arg : G);
172 pragma Export (Ada, pd);
173 pragma Export (Ada, pf);
174 pragma Export (Ada, pg);
175 -- These are like the Debug_Output_D/F/G procedures except that they
176 -- output a line return after the output. They were originally present
177 -- for direct use in GDB before GDB recognized Vax floating-point
178 -- types, and are retained for backwards compatibility.
180 private
181 pragma Inline (D_To_G);
182 pragma Inline (F_To_G);
183 pragma Inline (F_To_Q);
184 pragma Inline (F_To_S);
185 pragma Inline (G_To_D);
186 pragma Inline (G_To_F);
187 pragma Inline (G_To_Q);
188 pragma Inline (G_To_T);
189 pragma Inline (Q_To_F);
190 pragma Inline (Q_To_G);
191 pragma Inline (S_To_F);
192 pragma Inline (T_To_G);
194 pragma Inline (Abs_F);
195 pragma Inline (Abs_G);
196 pragma Inline (Add_F);
197 pragma Inline (Add_G);
198 pragma Inline (Div_G);
199 pragma Inline (Div_F);
200 pragma Inline (Mul_F);
201 pragma Inline (Mul_G);
202 pragma Inline (Neg_G);
203 pragma Inline (Neg_F);
204 pragma Inline (Sub_F);
205 pragma Inline (Sub_G);
207 pragma Inline (Eq_F);
208 pragma Inline (Eq_G);
209 pragma Inline (Le_F);
210 pragma Inline (Le_G);
211 pragma Inline (Lt_F);
212 pragma Inline (Lt_G);
214 end System.Vax_Float_Operations;