annotate gcc/config/avr/stdfix.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1 /* Copyright (C) 2007-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 This file is part of GCC.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
7 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
8 any later version.
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
13 GNU General Public License for more details.
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
16 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
17 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
20 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
22 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* ISO/IEC JTC1 SC22 WG14 N1169
kono
parents:
diff changeset
25 * Date: 2006-04-04
kono
parents:
diff changeset
26 * ISO/IEC TR 18037
kono
parents:
diff changeset
27 * Programming languages - C - Extensions to support embedded processors
kono
parents:
diff changeset
28 */
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 #ifndef _AVRGCC_STDFIX_H
kono
parents:
diff changeset
31 #define _AVRGCC_STDFIX_H
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 /* 7.18a.1 Introduction. */
kono
parents:
diff changeset
34 /* 7.18a.3 Precision macros. */
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 #include <stdfix-gcc.h>
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 typedef signed char int_hr_t;
kono
parents:
diff changeset
42 typedef unsigned char uint_uhr_t;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 typedef short int int_r_t;
kono
parents:
diff changeset
45 typedef short unsigned int uint_ur_t;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 typedef short int int_hk_t;
kono
parents:
diff changeset
48 typedef short unsigned int uint_uhk_t;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 typedef long int int_lr_t;
kono
parents:
diff changeset
51 typedef long unsigned int uint_ulr_t;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 typedef long int int_k_t;
kono
parents:
diff changeset
54 typedef long unsigned int uint_uk_t;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 typedef long long int int_llr_t;
kono
parents:
diff changeset
57 typedef long long unsigned int uint_ullr_t;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 typedef long long int int_lk_t;
kono
parents:
diff changeset
60 typedef long long unsigned int uint_ulk_t;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 typedef long long int int_llk_t;
kono
parents:
diff changeset
63 typedef long long unsigned int uint_ullk_t;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 #elif __SIZEOF_INT__ == 1 /* -mint8 */
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 typedef signed char int_hr_t;
kono
parents:
diff changeset
68 typedef unsigned char uint_uhr_t;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 typedef long int int_r_t;
kono
parents:
diff changeset
71 typedef long unsigned int uint_ur_t;
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 typedef long int int_hk_t;
kono
parents:
diff changeset
74 typedef long unsigned int uint_uhk_t;
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 typedef long long int int_lr_t;
kono
parents:
diff changeset
77 typedef long long unsigned int uint_ulr_t;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 typedef long long int int_k_t;
kono
parents:
diff changeset
80 typedef long long unsigned int uint_uk_t;
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 #endif /* __SIZEOF_INT__ == 1, 2 */
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 /* 7.18a.6 The fixed-point intrinsic functions. */
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 /* 7.18a.6.2 The fixed-point absolute value functions. */
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 #define abshr __builtin_avr_abshr
kono
parents:
diff changeset
91 #define absr __builtin_avr_absr
kono
parents:
diff changeset
92 #define abslr __builtin_avr_abslr
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 #define abshk __builtin_avr_abshk
kono
parents:
diff changeset
95 #define absk __builtin_avr_absk
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 #define abslk __builtin_avr_abslk
kono
parents:
diff changeset
100 #define absllr __builtin_avr_absllr /* GCC Extension */
kono
parents:
diff changeset
101 #define absllk __builtin_avr_absllk /* GCC Extension */
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 #endif /* sizeof (int) == 2 */
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 /* 7.18a.6.3 The fixed-point round functions. */
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 /* The Embedded-C paper specifies results only for rounding points
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 0 < RP < FBIT
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 As an extension, the following functions work as expected
kono
parents:
diff changeset
113 with rounding points
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 -IBIT < RP < FBIT
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 For example, rounding an accum with a rounding point of -1 will
kono
parents:
diff changeset
118 result in an even integer value. */
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 #define roundhr __builtin_avr_roundhr
kono
parents:
diff changeset
121 #define roundr __builtin_avr_roundr
kono
parents:
diff changeset
122 #define roundlr __builtin_avr_roundlr
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 #define rounduhr __builtin_avr_rounduhr
kono
parents:
diff changeset
125 #define roundur __builtin_avr_roundur
kono
parents:
diff changeset
126 #define roundulr __builtin_avr_roundulr
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 #define roundhk __builtin_avr_roundhk
kono
parents:
diff changeset
129 #define roundk __builtin_avr_roundk
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 #define rounduhk __builtin_avr_rounduhk
kono
parents:
diff changeset
132 #define rounduk __builtin_avr_rounduk
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 #define roundlk __builtin_avr_roundlk
kono
parents:
diff changeset
137 #define roundulk __builtin_avr_roundulk
kono
parents:
diff changeset
138 #define roundllr __builtin_avr_roundllr /* GCC Extension */
kono
parents:
diff changeset
139 #define roundullr __builtin_avr_roundullr /* GCC Extension */
kono
parents:
diff changeset
140 #define roundllk __builtin_avr_roundllk /* GCC Extension */
kono
parents:
diff changeset
141 #define roundullk __builtin_avr_roundullk /* GCC Extension */
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 #endif /* sizeof (int) == 2 */
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 /* 7.18a.6.4 The fixed-point bit countls functions. */
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 #define countlshr __builtin_avr_countlshr
kono
parents:
diff changeset
149 #define countlsr __builtin_avr_countlsr
kono
parents:
diff changeset
150 #define countlslr __builtin_avr_countlslr
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 #define countlsuhr __builtin_avr_countlsuhr
kono
parents:
diff changeset
153 #define countlsur __builtin_avr_countlsur
kono
parents:
diff changeset
154 #define countlsulr __builtin_avr_countlsulr
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 #define countlshk __builtin_avr_countlshk
kono
parents:
diff changeset
157 #define countlsk __builtin_avr_countlsk
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 #define countlsuhk __builtin_avr_countlsuhk
kono
parents:
diff changeset
160 #define countlsuk __builtin_avr_countlsuk
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 #define countlslk __builtin_avr_countlslk
kono
parents:
diff changeset
165 #define countlsulk __builtin_avr_countlsulk
kono
parents:
diff changeset
166 #define countlsllr __builtin_avr_countlsllr /* GCC Extension */
kono
parents:
diff changeset
167 #define countlsullr __builtin_avr_countlsullr /* GCC Extension */
kono
parents:
diff changeset
168 #define countlsllk __builtin_avr_countlsllk /* GCC Extension */
kono
parents:
diff changeset
169 #define countlsullk __builtin_avr_countlsullk /* GCC Extension */
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 #endif /* sizeof (int) == 2 */
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 /* 7.18a.6.5 The bitwise fixed-point to integer conversion functions. */
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 #define bitshr __builtin_avr_bitshr
kono
parents:
diff changeset
177 #define bitsr __builtin_avr_bitsr
kono
parents:
diff changeset
178 #define bitslr __builtin_avr_bitslr
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 #define bitsuhr __builtin_avr_bitsuhr
kono
parents:
diff changeset
181 #define bitsur __builtin_avr_bitsur
kono
parents:
diff changeset
182 #define bitsulr __builtin_avr_bitsulr
kono
parents:
diff changeset
183
kono
parents:
diff changeset
184 #define bitshk __builtin_avr_bitshk
kono
parents:
diff changeset
185 #define bitsk __builtin_avr_bitsk
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 #define bitsuhk __builtin_avr_bitsuhk
kono
parents:
diff changeset
188 #define bitsuk __builtin_avr_bitsuk
kono
parents:
diff changeset
189
kono
parents:
diff changeset
190 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 #define bitslk __builtin_avr_bitslk
kono
parents:
diff changeset
193 #define bitsulk __builtin_avr_bitsulk
kono
parents:
diff changeset
194 #define bitsllr __builtin_avr_bitsllr /* GCC Extension */
kono
parents:
diff changeset
195 #define bitsullr __builtin_avr_bitsullr /* GCC Extension */
kono
parents:
diff changeset
196 #define bitsllk __builtin_avr_bitsllk /* GCC Extension */
kono
parents:
diff changeset
197 #define bitsullk __builtin_avr_bitsullk /* GCC Extension */
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 #endif /* sizeof (int) == 2 */
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 /* 7.18a.6.6 The bitwise integer to fixed-point conversion functions. */
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 #define hrbits __builtin_avr_hrbits
kono
parents:
diff changeset
205 #define rbits __builtin_avr_rbits
kono
parents:
diff changeset
206 #define lrbits __builtin_avr_lrbits
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 #define uhrbits __builtin_avr_uhrbits
kono
parents:
diff changeset
209 #define urbits __builtin_avr_urbits
kono
parents:
diff changeset
210 #define ulrbits __builtin_avr_ulrbits
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 #define hkbits __builtin_avr_hkbits
kono
parents:
diff changeset
213 #define kbits __builtin_avr_kbits
kono
parents:
diff changeset
214
kono
parents:
diff changeset
215 #define uhkbits __builtin_avr_uhkbits
kono
parents:
diff changeset
216 #define ukbits __builtin_avr_ukbits
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 #if __SIZEOF_INT__ == 2
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 #define lkbits __builtin_avr_lkbits
kono
parents:
diff changeset
221 #define ulkbits __builtin_avr_ulkbits
kono
parents:
diff changeset
222 #define llrbits __builtin_avr_llrbits /* GCC Extension */
kono
parents:
diff changeset
223 #define ullrbits __builtin_avr_ullrbits /* GCC Extension */
kono
parents:
diff changeset
224 #define llkbits __builtin_avr_llkbits /* GCC Extension */
kono
parents:
diff changeset
225 #define ullkbits __builtin_avr_ullkbits /* GCC Extension */
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227 #endif /* sizeof (int) == 2 */
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 /* 7.18a.6.7 Type-generic fixed-point functions. */
kono
parents:
diff changeset
231
kono
parents:
diff changeset
232 #define absfx __builtin_avr_absfx
kono
parents:
diff changeset
233 #define roundfx __builtin_avr_roundfx
kono
parents:
diff changeset
234 #define countlsfx __builtin_avr_countlsfx
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 /* Hook in stuff from AVR-Libc. */
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 #if (defined (__WITH_AVRLIBC__) \
kono
parents:
diff changeset
240 && defined (__has_include) \
kono
parents:
diff changeset
241 && __has_include (<stdfix-avrlibc.h>))
kono
parents:
diff changeset
242 #include <stdfix-avrlibc.h>
kono
parents:
diff changeset
243 #endif
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 #endif /* _AVRGCC_STDFIX_H */