Mercurial > hg > CbC > CbC_gcc
annotate gcc/fixed-value.h @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | 04ced10e8804 |
rev | line source |
---|---|
0 | 1 /* Fixed-point arithmetic support. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
6 GCC is free software; you can redistribute it and/or modify it under | |
7 the terms of the GNU General Public License as published by the Free | |
8 Software Foundation; either version 3, or (at your option) any later | |
9 version. | |
10 | |
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GCC; see the file COPYING3. If not see | |
18 <http://www.gnu.org/licenses/>. */ | |
19 | |
20 #ifndef GCC_FIXED_VALUE_H | |
21 #define GCC_FIXED_VALUE_H | |
22 | |
23 #include "machmode.h" | |
24 #include "real.h" | |
25 #include "double-int.h" | |
26 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
27 struct GTY(()) fixed_value |
0 | 28 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
29 double_int data; /* Store data up to 2 wide integers. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
30 enum machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ |
0 | 31 }; |
32 | |
33 #define FIXED_VALUE_TYPE struct fixed_value | |
34 | |
35 #define MAX_FCONST0 18 /* For storing 18 fixed-point zeros per | |
36 fract, ufract, accum, and uaccum modes . */ | |
37 #define MAX_FCONST1 8 /* For storing 8 fixed-point ones per accum | |
38 and uaccum modes. */ | |
39 /* Constant fixed-point values 0 and 1. */ | |
40 extern FIXED_VALUE_TYPE fconst0[MAX_FCONST0]; | |
41 extern FIXED_VALUE_TYPE fconst1[MAX_FCONST1]; | |
42 | |
43 /* Macros to access fconst0 and fconst1 via machine modes. */ | |
44 #define FCONST0(mode) fconst0[mode - QQmode] | |
45 #define FCONST1(mode) fconst1[mode - HAmode] | |
46 | |
47 /* Return a CONST_FIXED with value R and mode M. */ | |
48 #define CONST_FIXED_FROM_FIXED_VALUE(r, m) \ | |
49 const_fixed_from_fixed_value (r, m) | |
50 extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, enum machine_mode); | |
51 | |
52 /* Initialize from a decimal or hexadecimal string. */ | |
53 extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *, | |
54 enum machine_mode); | |
55 | |
56 /* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */ | |
57 extern tree build_fixed (tree, FIXED_VALUE_TYPE); | |
58 | |
59 /* Extend or truncate to a new mode. */ | |
60 extern bool fixed_convert (FIXED_VALUE_TYPE *, enum machine_mode, | |
61 const FIXED_VALUE_TYPE *, bool); | |
62 | |
63 /* Convert to a fixed-point mode from an integer. */ | |
64 extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, enum machine_mode, | |
65 double_int, bool, bool); | |
66 | |
67 /* Convert to a fixed-point mode from a real. */ | |
68 extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, enum machine_mode, | |
69 const REAL_VALUE_TYPE *, bool); | |
70 | |
71 /* Convert to a real mode from a fixed-point. */ | |
72 extern void real_convert_from_fixed (REAL_VALUE_TYPE *, enum machine_mode, | |
73 const FIXED_VALUE_TYPE *); | |
74 | |
75 /* Compare two fixed-point objects for bitwise identity. */ | |
76 extern bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *); | |
77 | |
78 /* Calculate a hash value. */ | |
79 extern unsigned int fixed_hash (const FIXED_VALUE_TYPE *); | |
80 | |
81 #define FIXED_VALUES_IDENTICAL(x, y) fixed_identical (&(x), &(y)) | |
82 | |
83 /* Determine whether a fixed-point value X is negative. */ | |
84 #define FIXED_VALUE_NEGATIVE(x) fixed_isneg (&(x)) | |
85 | |
86 /* Render F as a decimal floating point constant. */ | |
87 extern void fixed_to_decimal (char *str, const FIXED_VALUE_TYPE *, size_t); | |
88 | |
89 /* Binary or unary arithmetic on tree_code. */ | |
90 extern bool fixed_arithmetic (FIXED_VALUE_TYPE *, int, const FIXED_VALUE_TYPE *, | |
91 const FIXED_VALUE_TYPE *, bool); | |
92 | |
93 /* Compare fixed-point values by tree_code. */ | |
94 extern bool fixed_compare (int, const FIXED_VALUE_TYPE *, | |
95 const FIXED_VALUE_TYPE *); | |
96 | |
97 /* Determine whether a fixed-point value X is negative. */ | |
98 extern bool fixed_isneg (const FIXED_VALUE_TYPE *); | |
99 | |
100 #endif /* GCC_FIXED_VALUE_H */ |