OSDN Git Service

* gcc.dg/attr-weakref-1.c: Add exit (0) to avoid spurious
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-vaflop.ads
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 --          Copyright (C) 1997-2005 Free Software Foundation, Inc.          --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package contains runtime routines for handling the non-IEEE
35 --  floating-point formats used on the Vax and the Alpha.
36
37 package System.Vax_Float_Operations is
38
39    pragma Warnings (Off);
40    --  Suppress warnings if not on Alpha/VAX
41
42    type D is digits 9;
43    pragma Float_Representation (VAX_Float, D);
44    --  D Float type on Vax
45
46    type G is digits 15;
47    pragma Float_Representation (VAX_Float, G);
48    --  G Float type on Vax
49
50    type F is digits 6;
51    pragma Float_Representation (VAX_Float, F);
52    --  F Float type on Vax
53
54    type S is digits 6;
55    pragma Float_Representation (IEEE_Float, S);
56    --  IEEE short
57
58    type T is digits 15;
59    pragma Float_Representation (IEEE_Float, T);
60    --  IEEE long
61
62    pragma Warnings (On);
63
64    type Q is range -2 ** 63 .. +(2 ** 63 - 1);
65    --  64-bit signed integer
66
67    --------------------------
68    -- Conversion Functions --
69    --------------------------
70
71    function D_To_G (X : D) return G;
72    function G_To_D (X : G) return D;
73    --  Conversions between D float and G float
74
75    function G_To_F (X : G) return F;
76    function F_To_G (X : F) return G;
77    --  Conversions between F float and G float
78
79    function F_To_S (X : F) return S;
80    function S_To_F (X : S) return F;
81    --  Conversions between F float and IEEE short
82
83    function G_To_T (X : G) return T;
84    function T_To_G (X : T) return G;
85    --  Conversions between G float and IEEE long
86
87    function F_To_Q (X : F) return Q;
88    function Q_To_F (X : Q) return F;
89    --  Conversions between F float and 64-bit integer
90
91    function G_To_Q (X : G) return Q;
92    function Q_To_G (X : Q) return G;
93    --  Conversions between G float and 64-bit integer
94
95    function T_To_D (X : T) return D;
96    --  Conversion from IEEE long to D_Float (used for literals)
97
98    --------------------------
99    -- Arithmetic Functions --
100    --------------------------
101
102    function Abs_F (X : F) return F;
103    function Abs_G (X : G) return G;
104    --  Absolute value of F/G float
105
106    function Add_F (X, Y : F) return F;
107    function Add_G (X, Y : G) return G;
108    --  Addition of F/G float
109
110    function Div_F (X, Y : F) return F;
111    function Div_G (X, Y : G) return G;
112    --  Division of F/G float
113
114    function Mul_F (X, Y : F) return F;
115    function Mul_G (X, Y : G) return G;
116    --  Multiplication of F/G float
117
118    function Neg_F (X : F) return F;
119    function Neg_G (X : G) return G;
120    --  Negation of F/G float
121
122    function Sub_F (X, Y : F) return F;
123    function Sub_G (X, Y : G) return G;
124    --  Subtraction of F/G float
125
126    --------------------------
127    -- Comparison Functions --
128    --------------------------
129
130    function Eq_F (X, Y : F) return Boolean;
131    function Eq_G (X, Y : G) return Boolean;
132    --  Compares for X = Y
133
134    function Le_F (X, Y : F) return Boolean;
135    function Le_G (X, Y : G) return Boolean;
136    --  Compares for X <= Y
137
138    function Lt_F (X, Y : F) return Boolean;
139    function Lt_G (X, Y : G) return Boolean;
140    --  Compares for X < Y
141
142    ----------------------------------
143    -- Routines for Valid Attribute --
144    ----------------------------------
145
146    function Valid_D (Arg : D) return Boolean;
147    function Valid_F (Arg : F) return Boolean;
148    function Valid_G (Arg : G) return Boolean;
149    --  Test whether Arg has a valid representation
150
151    ----------------------
152    -- Debug Procedures --
153    ----------------------
154
155    procedure Debug_Output_D (Arg : D);
156    procedure Debug_Output_F (Arg : F);
157    procedure Debug_Output_G (Arg : G);
158    pragma Export (Ada, Debug_Output_D);
159    pragma Export (Ada, Debug_Output_F);
160    pragma Export (Ada, Debug_Output_G);
161    --  These routines output their argument in decimal string form, with
162    --  no terminating line return. They are provided for implicit use by
163    --  the pre gnat-3.12w GDB, and are retained for backwards compatibility.
164
165    function Debug_String_D (Arg : D) return System.Address;
166    function Debug_String_F (Arg : F) return System.Address;
167    function Debug_String_G (Arg : G) return System.Address;
168    pragma Export (Ada, Debug_String_D);
169    pragma Export (Ada, Debug_String_F);
170    pragma Export (Ada, Debug_String_G);
171    --  These routines return a decimal C string image of their argument.
172    --  They are provided for implicit use by the debugger, in response to
173    --  the special encoding used for Vax floating-point types (see Exp_Dbug
174    --  for details). They supercede the above Debug_Output_D/F/G routines
175    --  which didn't work properly with GDBTK.
176
177    procedure pd (Arg : D);
178    procedure pf (Arg : F);
179    procedure pg (Arg : G);
180    pragma Export (Ada, pd);
181    pragma Export (Ada, pf);
182    pragma Export (Ada, pg);
183    --  These are like the Debug_Output_D/F/G procedures except that they
184    --  output a line return after the output. They were originally present
185    --  for direct use in GDB before GDB recognized Vax floating-point
186    --  types, and are retained for backwards compatibility.
187
188 private
189    pragma Inline (D_To_G);
190    pragma Inline (F_To_G);
191    pragma Inline (F_To_Q);
192    pragma Inline (F_To_S);
193    pragma Inline (G_To_D);
194    pragma Inline (G_To_F);
195    pragma Inline (G_To_Q);
196    pragma Inline (G_To_T);
197    pragma Inline (Q_To_F);
198    pragma Inline (Q_To_G);
199    pragma Inline (S_To_F);
200    pragma Inline (T_To_G);
201
202    pragma Inline (Abs_F);
203    pragma Inline (Abs_G);
204    pragma Inline (Add_F);
205    pragma Inline (Add_G);
206    pragma Inline (Div_G);
207    pragma Inline (Div_F);
208    pragma Inline (Mul_F);
209    pragma Inline (Mul_G);
210    pragma Inline (Neg_G);
211    pragma Inline (Neg_F);
212    pragma Inline (Sub_F);
213    pragma Inline (Sub_G);
214
215    pragma Inline (Eq_F);
216    pragma Inline (Eq_G);
217    pragma Inline (Le_F);
218    pragma Inline (Le_G);
219    pragma Inline (Lt_F);
220    pragma Inline (Lt_G);
221
222    pragma Inline (Valid_D);
223    pragma Inline (Valid_F);
224    pragma Inline (Valid_G);
225
226 end System.Vax_Float_Operations;