OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [s-vaflop.ads] - Blame information for rev 281

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
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-2009, 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 3,  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.                                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
-- GNAT was originally developed  by the GNAT team at  New York University. --
28
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29
--                                                                          --
30
------------------------------------------------------------------------------
31
 
32
--  This package contains runtime routines for handling the non-IEEE
33
--  floating-point formats used on the Vax and the Alpha.
34
 
35
package System.Vax_Float_Operations is
36
 
37
   pragma Warnings (Off);
38
   --  Suppress warnings if not on Alpha/VAX
39
 
40
   type D is digits 9;
41
   pragma Float_Representation (VAX_Float, D);
42
   --  D Float type on Vax
43
 
44
   type G is digits 15;
45
   pragma Float_Representation (VAX_Float, G);
46
   --  G Float type on Vax
47
 
48
   type F is digits 6;
49
   pragma Float_Representation (VAX_Float, F);
50
   --  F Float type on Vax
51
 
52
   type S is digits 6;
53
   pragma Float_Representation (IEEE_Float, S);
54
   --  IEEE short
55
 
56
   type T is digits 15;
57
   pragma Float_Representation (IEEE_Float, T);
58
   --  IEEE long
59
 
60
   pragma Warnings (On);
61
 
62
   type Q is range -2 ** 63 .. +(2 ** 63 - 1);
63
   --  64-bit signed integer
64
 
65
   --------------------------
66
   -- Conversion Functions --
67
   --------------------------
68
 
69
   function D_To_G (X : D) return G;
70
   function G_To_D (X : G) return D;
71
   --  Conversions between D float and G float
72
 
73
   function G_To_F (X : G) return F;
74
   function F_To_G (X : F) return G;
75
   --  Conversions between F float and G float
76
 
77
   function F_To_S (X : F) return S;
78
   function S_To_F (X : S) return F;
79
   --  Conversions between F float and IEEE short
80
 
81
   function G_To_T (X : G) return T;
82
   function T_To_G (X : T) return G;
83
   --  Conversions between G float and IEEE long
84
 
85
   function F_To_Q (X : F) return Q;
86
   function Q_To_F (X : Q) return F;
87
   --  Conversions between F float and 64-bit integer
88
 
89
   function G_To_Q (X : G) return Q;
90
   function Q_To_G (X : Q) return G;
91
   --  Conversions between G float and 64-bit integer
92
 
93
   function T_To_D (X : T) return D;
94
   --  Conversion from IEEE long to D_Float (used for literals)
95
 
96
   --------------------------
97
   -- Arithmetic Functions --
98
   --------------------------
99
 
100
   function Abs_F (X : F) return F;
101
   function Abs_G (X : G) return G;
102
   --  Absolute value of F/G float
103
 
104
   function Add_F (X, Y : F) return F;
105
   function Add_G (X, Y : G) return G;
106
   --  Addition of F/G float
107
 
108
   function Div_F (X, Y : F) return F;
109
   function Div_G (X, Y : G) return G;
110
   --  Division of F/G float
111
 
112
   function Mul_F (X, Y : F) return F;
113
   function Mul_G (X, Y : G) return G;
114
   --  Multiplication of F/G float
115
 
116
   function Neg_F (X : F) return F;
117
   function Neg_G (X : G) return G;
118
   --  Negation of F/G float
119
 
120
   function Sub_F (X, Y : F) return F;
121
   function Sub_G (X, Y : G) return G;
122
   --  Subtraction of F/G float
123
 
124
   --------------------------
125
   -- Comparison Functions --
126
   --------------------------
127
 
128
   function Eq_F (X, Y : F) return Boolean;
129
   function Eq_G (X, Y : G) return Boolean;
130
   --  Compares for X = Y
131
 
132
   function Le_F (X, Y : F) return Boolean;
133
   function Le_G (X, Y : G) return Boolean;
134
   --  Compares for X <= Y
135
 
136
   function Lt_F (X, Y : F) return Boolean;
137
   function Lt_G (X, Y : G) return Boolean;
138
   --  Compares for X < Y
139
 
140
   function Ne_F (X, Y : F) return Boolean;
141
   function Ne_G (X, Y : G) return Boolean;
142
   --  Compares for X /= Y
143
 
144
   ----------------------
145
   -- Return Functions --
146
   ----------------------
147
 
148
   function Return_D (X : D) return D;
149
   function Return_F (X : F) return F;
150
   function Return_G (X : G) return G;
151
   --  Deal with returned value for an imported function where the function
152
   --  result is of VAX Float type. Usually nothing needs to be done, and these
153
   --  functions return their argument unchanged. But for the case of VMS Alpha
154
   --  the return value is already in $f0, so we need to trick the compiler
155
   --  into thinking that we are moving X to $f0. See bodies for this case
156
   --  for the Asm sequence generated to achieve this.
157
 
158
   ----------------------------------
159
   -- Routines for Valid Attribute --
160
   ----------------------------------
161
 
162
   function Valid_D (Arg : D) return Boolean;
163
   function Valid_F (Arg : F) return Boolean;
164
   function Valid_G (Arg : G) return Boolean;
165
   --  Test whether Arg has a valid representation
166
 
167
   ----------------------
168
   -- Debug Procedures --
169
   ----------------------
170
 
171
   procedure Debug_Output_D (Arg : D);
172
   procedure Debug_Output_F (Arg : F);
173
   procedure Debug_Output_G (Arg : G);
174
   pragma Export (Ada, Debug_Output_D);
175
   pragma Export (Ada, Debug_Output_F);
176
   pragma Export (Ada, Debug_Output_G);
177
   --  These routines output their argument in decimal string form, with
178
   --  no terminating line return. They are provided for implicit use by
179
   --  the pre gnat-3.12w GDB, and are retained for backwards compatibility.
180
 
181
   function Debug_String_D (Arg : D) return System.Address;
182
   function Debug_String_F (Arg : F) return System.Address;
183
   function Debug_String_G (Arg : G) return System.Address;
184
   pragma Export (Ada, Debug_String_D);
185
   pragma Export (Ada, Debug_String_F);
186
   pragma Export (Ada, Debug_String_G);
187
   --  These routines return a decimal C string image of their argument.
188
   --  They are provided for implicit use by the debugger, in response to
189
   --  the special encoding used for Vax floating-point types (see Exp_Dbug
190
   --  for details). They supersede the above Debug_Output_D/F/G routines
191
   --  which didn't work properly with GDBTK.
192
 
193
   procedure pd (Arg : D);
194
   procedure pf (Arg : F);
195
   procedure pg (Arg : G);
196
   pragma Export (Ada, pd);
197
   pragma Export (Ada, pf);
198
   pragma Export (Ada, pg);
199
   --  These are like the Debug_Output_D/F/G procedures except that they
200
   --  output a line return after the output. They were originally present
201
   --  for direct use in GDB before GDB recognized Vax floating-point
202
   --  types, and are retained for backwards compatibility.
203
 
204
private
205
   pragma Inline_Always (D_To_G);
206
   pragma Inline_Always (F_To_G);
207
   pragma Inline_Always (F_To_Q);
208
   pragma Inline_Always (F_To_S);
209
   pragma Inline_Always (G_To_D);
210
   pragma Inline_Always (G_To_F);
211
   pragma Inline_Always (G_To_Q);
212
   pragma Inline_Always (G_To_T);
213
   pragma Inline_Always (Q_To_F);
214
   pragma Inline_Always (Q_To_G);
215
   pragma Inline_Always (S_To_F);
216
   pragma Inline_Always (T_To_G);
217
 
218
   pragma Inline_Always (Abs_F);
219
   pragma Inline_Always (Abs_G);
220
   pragma Inline_Always (Add_F);
221
   pragma Inline_Always (Add_G);
222
   pragma Inline_Always (Div_G);
223
   pragma Inline_Always (Div_F);
224
   pragma Inline_Always (Mul_F);
225
   pragma Inline_Always (Mul_G);
226
   pragma Inline_Always (Neg_G);
227
   pragma Inline_Always (Neg_F);
228
   pragma Inline_Always (Return_D);
229
   pragma Inline_Always (Return_F);
230
   pragma Inline_Always (Return_G);
231
   pragma Inline_Always (Sub_F);
232
   pragma Inline_Always (Sub_G);
233
 
234
   pragma Inline_Always (Eq_F);
235
   pragma Inline_Always (Eq_G);
236
   pragma Inline_Always (Le_F);
237
   pragma Inline_Always (Le_G);
238
   pragma Inline_Always (Lt_F);
239
   pragma Inline_Always (Lt_G);
240
   pragma Inline_Always (Ne_F);
241
   pragma Inline_Always (Ne_G);
242
 
243
   pragma Inline_Always (Valid_D);
244
   pragma Inline_Always (Valid_F);
245
   pragma Inline_Always (Valid_G);
246
 
247
end System.Vax_Float_Operations;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.