1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
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 --
9 -- $Revision: 1.13 $ --
11 -- Copyright (C) 1997-1998 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
34 ------------------------------------------------------------------------------
36 -- This package contains runtime routines for handling the non-IEEE
37 -- floating-point formats used on the Vax and the Alpha.
39 package System
.Vax_Float_Operations
is
41 pragma Warnings
(Off
);
42 -- Suppress warnings if not on Alpha/VAX
45 pragma Float_Representation
(VAX_Float
, D
);
46 -- D Float type on Vax
49 pragma Float_Representation
(VAX_Float
, G
);
50 -- G Float type on Vax
53 pragma Float_Representation
(VAX_Float
, F
);
54 -- F Float type on Vax
57 pragma Float_Representation
(IEEE_Float
, S
);
61 pragma Float_Representation
(IEEE_Float
, T
);
66 type Q
is range -2 ** 63 .. +(2 ** 63 - 1);
67 -- 64-bit signed integer
69 --------------------------
70 -- Conversion Functions --
71 --------------------------
73 function D_To_G
(X
: D
) return G
;
74 function G_To_D
(X
: G
) return D
;
75 -- Conversions between D float and G float
77 function G_To_F
(X
: G
) return F
;
78 function F_To_G
(X
: F
) return G
;
79 -- Conversions between F float and G float
81 function F_To_S
(X
: F
) return S
;
82 function S_To_F
(X
: S
) return F
;
83 -- Conversions between F float and IEEE short
85 function G_To_T
(X
: G
) return T
;
86 function T_To_G
(X
: T
) return G
;
87 -- Conversions between G float and IEEE long
89 function F_To_Q
(X
: F
) return Q
;
90 function Q_To_F
(X
: Q
) return F
;
91 -- Conversions between F float and 64-bit integer
93 function G_To_Q
(X
: G
) return Q
;
94 function Q_To_G
(X
: Q
) return G
;
95 -- Conversions between G float and 64-bit integer
97 function T_To_D
(X
: T
) return D
;
98 -- Conversion from IEEE long to D_Float (used for literals)
100 --------------------------
101 -- Arithmetic Functions --
102 --------------------------
104 function Abs_F
(X
: F
) return F
;
105 function Abs_G
(X
: G
) return G
;
106 -- Absolute value of F/G float
108 function Add_F
(X
, Y
: F
) return F
;
109 function Add_G
(X
, Y
: G
) return G
;
110 -- Addition of F/G float
112 function Div_F
(X
, Y
: F
) return F
;
113 function Div_G
(X
, Y
: G
) return G
;
114 -- Division of F/G float
116 function Mul_F
(X
, Y
: F
) return F
;
117 function Mul_G
(X
, Y
: G
) return G
;
118 -- Multiplication of F/G float
120 function Neg_F
(X
: F
) return F
;
121 function Neg_G
(X
: G
) return G
;
122 -- Negation of F/G float
124 function Sub_F
(X
, Y
: F
) return F
;
125 function Sub_G
(X
, Y
: G
) return G
;
126 -- Subtraction of F/G float
128 --------------------------
129 -- Comparison Functions --
130 --------------------------
132 function Eq_F
(X
, Y
: F
) return Boolean;
133 function Eq_G
(X
, Y
: G
) return Boolean;
134 -- Compares for X = Y
136 function Le_F
(X
, Y
: F
) return Boolean;
137 function Le_G
(X
, Y
: G
) return Boolean;
138 -- Compares for X <= Y
140 function Lt_F
(X
, Y
: F
) return Boolean;
141 function Lt_G
(X
, Y
: G
) return Boolean;
142 -- Compares for X < Y
144 ----------------------
145 -- Debug Procedures --
146 ----------------------
148 procedure Debug_Output_D
(Arg
: D
);
149 procedure Debug_Output_F
(Arg
: F
);
150 procedure Debug_Output_G
(Arg
: G
);
151 pragma Export
(Ada
, Debug_Output_D
);
152 pragma Export
(Ada
, Debug_Output_F
);
153 pragma Export
(Ada
, Debug_Output_G
);
154 -- These routines output their argument in decimal string form, with
155 -- no terminating line return. They are provided for implicit use by
156 -- the pre gnat-3.12w GDB, and are retained for backwards compatibility.
158 function Debug_String_D
(Arg
: D
) return System
.Address
;
159 function Debug_String_F
(Arg
: F
) return System
.Address
;
160 function Debug_String_G
(Arg
: G
) return System
.Address
;
161 pragma Export
(Ada
, Debug_String_D
);
162 pragma Export
(Ada
, Debug_String_F
);
163 pragma Export
(Ada
, Debug_String_G
);
164 -- These routines return a decimal C string image of their argument.
165 -- They are provided for implicit use by the debugger, in response to
166 -- the special encoding used for Vax floating-point types (see Exp_Dbug
167 -- for details). They supercede the above Debug_Output_D/F/G routines
168 -- which didn't work properly with GDBTK.
170 procedure pd
(Arg
: D
);
171 procedure pf
(Arg
: F
);
172 procedure pg
(Arg
: G
);
173 pragma Export
(Ada
, pd
);
174 pragma Export
(Ada
, pf
);
175 pragma Export
(Ada
, pg
);
176 -- These are like the Debug_Output_D/F/G procedures except that they
177 -- output a line return after the output. They were originally present
178 -- for direct use in GDB before GDB recognized Vax floating-point
179 -- types, and are retained for backwards compatibility.
182 pragma Inline
(D_To_G
);
183 pragma Inline
(F_To_G
);
184 pragma Inline
(F_To_Q
);
185 pragma Inline
(F_To_S
);
186 pragma Inline
(G_To_D
);
187 pragma Inline
(G_To_F
);
188 pragma Inline
(G_To_Q
);
189 pragma Inline
(G_To_T
);
190 pragma Inline
(Q_To_F
);
191 pragma Inline
(Q_To_G
);
192 pragma Inline
(S_To_F
);
193 pragma Inline
(T_To_G
);
195 pragma Inline
(Abs_F
);
196 pragma Inline
(Abs_G
);
197 pragma Inline
(Add_F
);
198 pragma Inline
(Add_G
);
199 pragma Inline
(Div_G
);
200 pragma Inline
(Div_F
);
201 pragma Inline
(Mul_F
);
202 pragma Inline
(Mul_G
);
203 pragma Inline
(Neg_G
);
204 pragma Inline
(Neg_F
);
205 pragma Inline
(Sub_F
);
206 pragma Inline
(Sub_G
);
208 pragma Inline
(Eq_F
);
209 pragma Inline
(Eq_G
);
210 pragma Inline
(Le_F
);
211 pragma Inline
(Le_G
);
212 pragma Inline
(Lt_F
);
213 pragma Inline
(Lt_G
);
215 end System
.Vax_Float_Operations
;