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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [common/] [cgen-ops.h] - Blame information for rev 280

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Semantics ops support for CGEN-based simulators.
2
   Copyright (C) 1996, 1997, 1998, 1999, 2002, 2007, 2008
3
   Free Software Foundation, Inc.
4
   Contributed by Cygnus Solutions.
5
 
6
This file is part of the GNU Simulators.
7
 
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
21
*/
22
 
23
#ifndef CGEN_SEM_OPS_H
24
#define CGEN_SEM_OPS_H
25
 
26
#include <assert.h>
27
 
28
#if defined (__GNUC__) && ! defined (SEMOPS_DEFINE_INLINE)
29
#define SEMOPS_DEFINE_INLINE
30
#define SEMOPS_INLINE extern inline
31
#else
32
#define SEMOPS_INLINE
33
#endif
34
 
35
/* Semantic operations.
36
   At one point this file was machine generated.  Maybe it will be again.  */
37
 
38
/* TODO: Lazy encoding/decoding of fp values.  */
39
 
40
/* These don't really have a mode.  */
41
#define ANDIF(x, y) ((x) && (y))
42
#define ORIF(x, y) ((x) || (y))
43
 
44
#define SUBBI(x, y) ((x) - (y))
45
#define ANDBI(x, y) ((x) & (y))
46
#define ORBI(x, y) ((x) | (y))
47
#define XORBI(x, y) ((x) ^ (y))
48
#define NEGBI(x) (- (x))
49
#define NOTBI(x) (! (BI) (x))
50
#define INVBI(x) (~ (x))
51
#define EQBI(x, y) ((BI) (x) == (BI) (y))
52
#define NEBI(x, y) ((BI) (x) != (BI) (y))
53
#define LTBI(x, y) ((BI) (x) < (BI) (y))
54
#define LEBI(x, y) ((BI) (x) <= (BI) (y))
55
#define GTBI(x, y) ((BI) (x) > (BI) (y))
56
#define GEBI(x, y) ((BI) (x) >= (BI) (y))
57
#define LTUBI(x, y) ((BI) (x) < (BI) (y))
58
#define LEUBI(x, y) ((BI) (x) <= (BI) (y))
59
#define GTUBI(x, y) ((BI) (x) > (BI) (y))
60
#define GEUBI(x, y) ((BI) (x) >= (BI) (y))
61
 
62
#define ADDQI(x, y) ((x) + (y))
63
#define SUBQI(x, y) ((x) - (y))
64
#define MULQI(x, y) ((x) * (y))
65
#define DIVQI(x, y) ((QI) (x) / (QI) (y))
66
#define UDIVQI(x, y) ((UQI) (x) / (UQI) (y))
67
#define MODQI(x, y) ((QI) (x) % (QI) (y))
68
#define UMODQI(x, y) ((UQI) (x) % (UQI) (y))
69
#define SRAQI(x, y) ((QI) (x) >> (y))
70
#define SRLQI(x, y) ((UQI) (x) >> (y))
71
#define SLLQI(x, y) ((UQI) (x) << (y))
72
extern QI RORQI (QI, int);
73
extern QI ROLQI (QI, int);
74
#define ANDQI(x, y) ((x) & (y))
75
#define ORQI(x, y) ((x) | (y))
76
#define XORQI(x, y) ((x) ^ (y))
77
#define NEGQI(x) (- (x))
78
#define NOTQI(x) (! (QI) (x))
79
#define INVQI(x) (~ (x))
80
#define ABSQI(x) ((x) < 0 ? -(x) : (x))
81
#define EQQI(x, y) ((QI) (x) == (QI) (y))
82
#define NEQI(x, y) ((QI) (x) != (QI) (y))
83
#define LTQI(x, y) ((QI) (x) < (QI) (y))
84
#define LEQI(x, y) ((QI) (x) <= (QI) (y))
85
#define GTQI(x, y) ((QI) (x) > (QI) (y))
86
#define GEQI(x, y) ((QI) (x) >= (QI) (y))
87
#define LTUQI(x, y) ((UQI) (x) < (UQI) (y))
88
#define LEUQI(x, y) ((UQI) (x) <= (UQI) (y))
89
#define GTUQI(x, y) ((UQI) (x) > (UQI) (y))
90
#define GEUQI(x, y) ((UQI) (x) >= (UQI) (y))
91
 
92
#define ADDHI(x, y) ((x) + (y))
93
#define SUBHI(x, y) ((x) - (y))
94
#define MULHI(x, y) ((x) * (y))
95
#define DIVHI(x, y) ((HI) (x) / (HI) (y))
96
#define UDIVHI(x, y) ((UHI) (x) / (UHI) (y))
97
#define MODHI(x, y) ((HI) (x) % (HI) (y))
98
#define UMODHI(x, y) ((UHI) (x) % (UHI) (y))
99
#define SRAHI(x, y) ((HI) (x) >> (y))
100
#define SRLHI(x, y) ((UHI) (x) >> (y))
101
#define SLLHI(x, y) ((UHI) (x) << (y))
102
extern HI RORHI (HI, int);
103
extern HI ROLHI (HI, int);
104
#define ANDHI(x, y) ((x) & (y))
105
#define ORHI(x, y) ((x) | (y))
106
#define XORHI(x, y) ((x) ^ (y))
107
#define NEGHI(x) (- (x))
108
#define NOTHI(x) (! (HI) (x))
109
#define INVHI(x) (~ (x))
110
#define ABSHI(x) ((x) < 0 ? -(x) : (x))
111
#define EQHI(x, y) ((HI) (x) == (HI) (y))
112
#define NEHI(x, y) ((HI) (x) != (HI) (y))
113
#define LTHI(x, y) ((HI) (x) < (HI) (y))
114
#define LEHI(x, y) ((HI) (x) <= (HI) (y))
115
#define GTHI(x, y) ((HI) (x) > (HI) (y))
116
#define GEHI(x, y) ((HI) (x) >= (HI) (y))
117
#define LTUHI(x, y) ((UHI) (x) < (UHI) (y))
118
#define LEUHI(x, y) ((UHI) (x) <= (UHI) (y))
119
#define GTUHI(x, y) ((UHI) (x) > (UHI) (y))
120
#define GEUHI(x, y) ((UHI) (x) >= (UHI) (y))
121
 
122
#define ADDSI(x, y) ((x) + (y))
123
#define SUBSI(x, y) ((x) - (y))
124
#define MULSI(x, y) ((x) * (y))
125
#define DIVSI(x, y) ((SI) (x) / (SI) (y))
126
#define UDIVSI(x, y) ((USI) (x) / (USI) (y))
127
#define MODSI(x, y) ((SI) (x) % (SI) (y))
128
#define UMODSI(x, y) ((USI) (x) % (USI) (y))
129
#define SRASI(x, y) ((SI) (x) >> (y))
130
#define SRLSI(x, y) ((USI) (x) >> (y))
131
#define SLLSI(x, y) ((USI) (x) << (y))
132
extern SI RORSI (SI, int);
133
extern SI ROLSI (SI, int);
134
#define ANDSI(x, y) ((x) & (y))
135
#define ORSI(x, y) ((x) | (y))
136
#define XORSI(x, y) ((x) ^ (y))
137
#define NEGSI(x) (- (x))
138
#define NOTSI(x) (! (SI) (x))
139
#define INVSI(x) (~ (x))
140
#define ABSSI(x) ((x) < 0 ? -(x) : (x))
141
#define EQSI(x, y) ((SI) (x) == (SI) (y))
142
#define NESI(x, y) ((SI) (x) != (SI) (y))
143
#define LTSI(x, y) ((SI) (x) < (SI) (y))
144
#define LESI(x, y) ((SI) (x) <= (SI) (y))
145
#define GTSI(x, y) ((SI) (x) > (SI) (y))
146
#define GESI(x, y) ((SI) (x) >= (SI) (y))
147
#define LTUSI(x, y) ((USI) (x) < (USI) (y))
148
#define LEUSI(x, y) ((USI) (x) <= (USI) (y))
149
#define GTUSI(x, y) ((USI) (x) > (USI) (y))
150
#define GEUSI(x, y) ((USI) (x) >= (USI) (y))
151
 
152
#ifdef DI_FN_SUPPORT
153
extern DI ADDDI (DI, DI);
154
extern DI SUBDI (DI, DI);
155
extern DI MULDI (DI, DI);
156
extern DI DIVDI (DI, DI);
157
extern DI UDIVDI (DI, DI);
158
extern DI MODDI (DI, DI);
159
extern DI UMODDI (DI, DI);
160
extern DI SRADI (DI, int);
161
extern UDI SRLDI (UDI, int);
162
extern UDI SLLDI (UDI, int);
163
extern DI RORDI (DI, int);
164
extern DI ROLDI (DI, int);
165
extern DI ANDDI (DI, DI);
166
extern DI ORDI (DI, DI);
167
extern DI XORDI (DI, DI);
168
extern DI NEGDI (DI);
169
extern int NOTDI (DI);
170
extern DI INVDI (DI);
171
extern int EQDI (DI, DI);
172
extern int NEDI (DI, DI);
173
extern int LTDI (DI, DI);
174
extern int LEDI (DI, DI);
175
extern int GTDI (DI, DI);
176
extern int GEDI (DI, DI);
177
extern int LTUDI (UDI, UDI);
178
extern int LEUDI (UDI, UDI);
179
extern int GTUDI (UDI, UDI);
180
extern int GEUDI (UDI, UDI);
181
#else /* ! DI_FN_SUPPORT */
182
#define ADDDI(x, y) ((x) + (y))
183
#define SUBDI(x, y) ((x) - (y))
184
#define MULDI(x, y) ((x) * (y))
185
#define DIVDI(x, y) ((DI) (x) / (DI) (y))
186
#define UDIVDI(x, y) ((UDI) (x) / (UDI) (y))
187
#define MODDI(x, y) ((DI) (x) % (DI) (y))
188
#define UMODDI(x, y) ((UDI) (x) % (UDI) (y))
189
#define SRADI(x, y) ((DI) (x) >> (y))
190
#define SRLDI(x, y) ((UDI) (x) >> (y))
191
#define SLLDI(x, y) ((UDI) (x) << (y))
192
extern DI RORDI (DI, int);
193
extern DI ROLDI (DI, int);
194
#define ANDDI(x, y) ((x) & (y))
195
#define ORDI(x, y) ((x) | (y))
196
#define XORDI(x, y) ((x) ^ (y))
197
#define NEGDI(x) (- (x))
198
#define NOTDI(x) (! (DI) (x))
199
#define INVDI(x) (~ (x))
200
#define ABSDI(x) ((x) < 0 ? -(x) : (x))
201
#define EQDI(x, y) ((DI) (x) == (DI) (y))
202
#define NEDI(x, y) ((DI) (x) != (DI) (y))
203
#define LTDI(x, y) ((DI) (x) < (DI) (y))
204
#define LEDI(x, y) ((DI) (x) <= (DI) (y))
205
#define GTDI(x, y) ((DI) (x) > (DI) (y))
206
#define GEDI(x, y) ((DI) (x) >= (DI) (y))
207
#define LTUDI(x, y) ((UDI) (x) < (UDI) (y))
208
#define LEUDI(x, y) ((UDI) (x) <= (UDI) (y))
209
#define GTUDI(x, y) ((UDI) (x) > (UDI) (y))
210
#define GEUDI(x, y) ((UDI) (x) >= (UDI) (y))
211
#endif /* DI_FN_SUPPORT */
212
 
213
#define EXTBIQI(x) ((QI) (BI) (x))
214
#define EXTBIHI(x) ((HI) (BI) (x))
215
#define EXTBISI(x) ((SI) (BI) (x))
216
#if defined (DI_FN_SUPPORT)
217
extern DI EXTBIDI (BI);
218
#else
219
#define EXTBIDI(x) ((DI) (BI) (x))
220
#endif
221
#define EXTQIHI(x) ((HI) (QI) (x))
222
#define EXTQISI(x) ((SI) (QI) (x))
223
#if defined (DI_FN_SUPPORT)
224
extern DI EXTQIDI (QI);
225
#else
226
#define EXTQIDI(x) ((DI) (QI) (x))
227
#endif
228
#define EXTHIHI(x) ((HI) (HI) (x))
229
#define EXTHISI(x) ((SI) (HI) (x))
230
#define EXTSISI(x) ((SI) (SI) (x))
231
#if defined (DI_FN_SUPPORT)
232
extern DI EXTHIDI (HI);
233
#else
234
#define EXTHIDI(x) ((DI) (HI) (x))
235
#endif
236
#if defined (DI_FN_SUPPORT)
237
extern DI EXTSIDI (SI);
238
#else
239
#define EXTSIDI(x) ((DI) (SI) (x))
240
#endif
241
 
242
#define ZEXTBIQI(x) ((QI) (BI) (x))
243
#define ZEXTBIHI(x) ((HI) (BI) (x))
244
#define ZEXTBISI(x) ((SI) (BI) (x))
245
#if defined (DI_FN_SUPPORT)
246
extern DI ZEXTBIDI (BI);
247
#else
248
#define ZEXTBIDI(x) ((DI) (BI) (x))
249
#endif
250
#define ZEXTQIHI(x) ((HI) (UQI) (x))
251
#define ZEXTQISI(x) ((SI) (UQI) (x))
252
#if defined (DI_FN_SUPPORT)
253
extern DI ZEXTQIDI (QI);
254
#else
255
#define ZEXTQIDI(x) ((DI) (UQI) (x))
256
#endif
257
#define ZEXTHISI(x) ((SI) (UHI) (x))
258
#define ZEXTHIHI(x) ((HI) (UHI) (x))
259
#define ZEXTSISI(x) ((SI) (USI) (x))
260
#if defined (DI_FN_SUPPORT)
261
extern DI ZEXTHIDI (HI);
262
#else
263
#define ZEXTHIDI(x) ((DI) (UHI) (x))
264
#endif
265
#if defined (DI_FN_SUPPORT)
266
extern DI ZEXTSIDI (SI);
267
#else
268
#define ZEXTSIDI(x) ((DI) (USI) (x))
269
#endif
270
 
271
#define TRUNCQIBI(x) ((BI) (QI) (x))
272
#define TRUNCHIBI(x) ((BI) (HI) (x))
273
#define TRUNCHIQI(x) ((QI) (HI) (x))
274
#define TRUNCSIBI(x) ((BI) (SI) (x))
275
#define TRUNCSIQI(x) ((QI) (SI) (x))
276
#define TRUNCSIHI(x) ((HI) (SI) (x))
277
#define TRUNCSISI(x) ((SI) (SI) (x))
278
#if defined (DI_FN_SUPPORT)
279
extern BI TRUNCDIBI (DI);
280
#else
281
#define TRUNCDIBI(x) ((BI) (DI) (x))
282
#endif
283
#if defined (DI_FN_SUPPORT)
284
extern QI TRUNCDIQI (DI);
285
#else
286
#define TRUNCDIQI(x) ((QI) (DI) (x))
287
#endif
288
#if defined (DI_FN_SUPPORT)
289
extern HI TRUNCDIHI (DI);
290
#else
291
#define TRUNCDIHI(x) ((HI) (DI) (x))
292
#endif
293
#if defined (DI_FN_SUPPORT)
294
extern SI TRUNCDISI (DI);
295
#else
296
#define TRUNCDISI(x) ((SI) (DI) (x))
297
#endif
298
 
299
/* Composing/decomposing the various types.
300
   Word ordering is endian-independent.  Words are specified most to least
301
   significant and word number 0 is the most significant word.
302
   ??? May also wish an endian-dependent version.  Later.  */
303
 
304
#ifdef SEMOPS_DEFINE_INLINE
305
 
306
SEMOPS_INLINE SF
307
SUBWORDSISF (SI in)
308
{
309
  union { SI in; SF out; } x;
310
  x.in = in;
311
  return x.out;
312
}
313
 
314
SEMOPS_INLINE DF
315
SUBWORDDIDF (DI in)
316
{
317
  union { DI in; DF out; } x;
318
  x.in = in;
319
  return x.out;
320
}
321
 
322
SEMOPS_INLINE QI
323
SUBWORDSIQI (SI in, int byte)
324
{
325
  assert (byte >= 0 && byte <= 3);
326
  return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
327
}
328
 
329
SEMOPS_INLINE UQI
330
SUBWORDSIUQI (SI in, int byte)
331
{
332
  assert (byte >= 0 && byte <= 3);
333
  return (UQI) (in >> (8 * (3 - byte))) & 0xFF;
334
}
335
 
336
SEMOPS_INLINE QI
337
SUBWORDDIQI (DI in, int byte)
338
{
339
  assert (byte >= 0 && byte <= 7);
340
  return (UQI) (in >> (8 * (7 - byte))) & 0xFF;
341
}
342
 
343
SEMOPS_INLINE HI
344
SUBWORDDIHI (DI in, int word)
345
{
346
  assert (word >= 0 && word <= 3);
347
  return (UHI) (in >> (16 * (3 - word))) & 0xFFFF;
348
}
349
 
350
SEMOPS_INLINE HI
351
SUBWORDSIHI (SI in, int word)
352
{
353
  if (word == 0)
354
    return (USI) in >> 16;
355
  else
356
    return in;
357
}
358
 
359
SEMOPS_INLINE SI
360
SUBWORDSFSI (SF in)
361
{
362
  union { SF in; SI out; } x;
363
  x.in = in;
364
  return x.out;
365
}
366
 
367
SEMOPS_INLINE DI
368
SUBWORDDFDI (DF in)
369
{
370
  union { DF in; DI out; } x;
371
  x.in = in;
372
  return x.out;
373
}
374
 
375
SEMOPS_INLINE UQI
376
SUBWORDDIUQI (DI in, int byte)
377
{
378
  assert (byte >= 0 && byte <= 7);
379
  return (UQI) (in >> (8 * (7 - byte)));
380
}
381
 
382
SEMOPS_INLINE SI
383
SUBWORDDISI (DI in, int word)
384
{
385
  if (word == 0)
386
    return (UDI) in >> 32;
387
  else
388
    return in;
389
}
390
 
391
SEMOPS_INLINE SI
392
SUBWORDDFSI (DF in, int word)
393
{
394
  /* Note: typedef UDI DF; */
395
  if (word == 0)
396
    return (UDI) in >> 32;
397
  else
398
    return in;
399
}
400
 
401
SEMOPS_INLINE SI
402
SUBWORDXFSI (XF in, int word)
403
{
404
  /* Note: typedef struct { SI parts[3]; } XF; */
405
  union { XF in; SI out[3]; } x;
406
  x.in = in;
407
  return x.out[word];
408
}
409
 
410
SEMOPS_INLINE SI
411
SUBWORDTFSI (TF in, int word)
412
{
413
  /* Note: typedef struct { SI parts[4]; } TF; */
414
  union { TF in; SI out[4]; } x;
415
  x.in = in;
416
  return x.out[word];
417
}
418
 
419
SEMOPS_INLINE DI
420
JOINSIDI (SI x0, SI x1)
421
{
422
  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
423
    return MAKEDI (x0, x1);
424
  else
425
    return MAKEDI (x1, x0);
426
}
427
 
428
SEMOPS_INLINE DF
429
JOINSIDF (SI x0, SI x1)
430
{
431
  union { SI in[2]; DF out; } x;
432
  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
433
    x.in[0] = x0, x.in[1] = x1;
434
  else
435
    x.in[1] = x0, x.in[0] = x1;
436
  return x.out;
437
}
438
 
439
SEMOPS_INLINE XF
440
JOINSIXF (SI x0, SI x1, SI x2)
441
{
442
  union { SI in[3]; XF out; } x;
443
  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
444
    x.in[0] = x0, x.in[1] = x1, x.in[2] = x2;
445
  else
446
    x.in[2] = x0, x.in[1] = x1, x.in[0] = x2;
447
  return x.out;
448
}
449
 
450
SEMOPS_INLINE TF
451
JOINSITF (SI x0, SI x1, SI x2, SI x3)
452
{
453
  union { SI in[4]; TF out; } x;
454
  if (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
455
    x.in[0] = x0, x.in[1] = x1, x.in[2] = x2, x.in[3] = x3;
456
  else
457
    x.in[3] = x0, x.in[2] = x1, x.in[1] = x2, x.in[0] = x3;
458
  return x.out;
459
}
460
 
461
#else
462
 
463
QI SUBWORDSIQI (SI);
464
HI SUBWORDSIHI (HI);
465
SI SUBWORDSFSI (SF);
466
SF SUBWORDSISF (SI);
467
DI SUBWORDDFDI (DF);
468
DF SUBWORDDIDF (DI);
469
QI SUBWORDDIQI (DI, int);
470
HI SUBWORDDIHI (DI, int);
471
SI SUBWORDDISI (DI, int);
472
SI SUBWORDDFSI (DF, int);
473
SI SUBWORDXFSI (XF, int);
474
SI SUBWORDTFSI (TF, int);
475
 
476
UQI SUBWORDSIUQI (SI);
477
UQI SUBWORDDIUQI (DI);
478
 
479
DI JOINSIDI (SI, SI);
480
DF JOINSIDF (SI, SI);
481
XF JOINSIXF (SI, SI, SI);
482
TF JOINSITF (SI, SI, SI, SI);
483
 
484
#endif /* SUBWORD,JOIN */
485
 
486
/* Semantic support utilities.  */
487
 
488
#ifdef SEMOPS_DEFINE_INLINE
489
 
490
SEMOPS_INLINE SI
491
ADDCSI (SI a, SI b, BI c)
492
{
493
  SI res = ADDSI (a, ADDSI (b, c));
494
  return res;
495
}
496
 
497
SEMOPS_INLINE BI
498
ADDCFSI (SI a, SI b, BI c)
499
{
500
  SI tmp = ADDSI (a, ADDSI (b, c));
501
  BI res = ((USI) tmp < (USI) a) || (c && tmp == a);
502
  return res;
503
}
504
 
505
SEMOPS_INLINE BI
506
ADDOFSI (SI a, SI b, BI c)
507
{
508
  SI tmp = ADDSI (a, ADDSI (b, c));
509
  BI res = (((a < 0) == (b < 0))
510
            && ((a < 0) != (tmp < 0)));
511
  return res;
512
}
513
 
514
SEMOPS_INLINE SI
515
SUBCSI (SI a, SI b, BI c)
516
{
517
  SI res = SUBSI (a, ADDSI (b, c));
518
  return res;
519
}
520
 
521
SEMOPS_INLINE BI
522
SUBCFSI (SI a, SI b, BI c)
523
{
524
  BI res = ((USI) a < (USI) b) || (c && a == b);
525
  return res;
526
}
527
 
528
SEMOPS_INLINE BI
529
SUBOFSI (SI a, SI b, BI c)
530
{
531
  SI tmp = SUBSI (a, ADDSI (b, c));
532
  BI res = (((a < 0) != (b < 0))
533
            && ((a < 0) != (tmp < 0)));
534
  return res;
535
}
536
 
537
SEMOPS_INLINE HI
538
ADDCHI (HI a, HI b, BI c)
539
{
540
  HI res = ADDHI (a, ADDHI (b, c));
541
  return res;
542
}
543
 
544
SEMOPS_INLINE BI
545
ADDCFHI (HI a, HI b, BI c)
546
{
547
  HI tmp = ADDHI (a, ADDHI (b, c));
548
  BI res = ((UHI) tmp < (UHI) a) || (c && tmp == a);
549
  return res;
550
}
551
 
552
SEMOPS_INLINE BI
553
ADDOFHI (HI a, HI b, BI c)
554
{
555
  HI tmp = ADDHI (a, ADDHI (b, c));
556
  BI res = (((a < 0) == (b < 0))
557
            && ((a < 0) != (tmp < 0)));
558
  return res;
559
}
560
 
561
SEMOPS_INLINE HI
562
SUBCHI (HI a, HI b, BI c)
563
{
564
  HI res = SUBHI (a, ADDHI (b, c));
565
  return res;
566
}
567
 
568
SEMOPS_INLINE BI
569
SUBCFHI (HI a, HI b, BI c)
570
{
571
  BI res = ((UHI) a < (UHI) b) || (c && a == b);
572
  return res;
573
}
574
 
575
SEMOPS_INLINE BI
576
SUBOFHI (HI a, HI b, BI c)
577
{
578
  HI tmp = SUBHI (a, ADDHI (b, c));
579
  BI res = (((a < 0) != (b < 0))
580
            && ((a < 0) != (tmp < 0)));
581
  return res;
582
}
583
 
584
SEMOPS_INLINE QI
585
ADDCQI (QI a, QI b, BI c)
586
{
587
  QI res = ADDQI (a, ADDQI (b, c));
588
  return res;
589
}
590
 
591
SEMOPS_INLINE BI
592
ADDCFQI (QI a, QI b, BI c)
593
{
594
  QI tmp = ADDQI (a, ADDQI (b, c));
595
  BI res = ((UQI) tmp < (UQI) a) || (c && tmp == a);
596
  return res;
597
}
598
 
599
SEMOPS_INLINE BI
600
ADDOFQI (QI a, QI b, BI c)
601
{
602
  QI tmp = ADDQI (a, ADDQI (b, c));
603
  BI res = (((a < 0) == (b < 0))
604
            && ((a < 0) != (tmp < 0)));
605
  return res;
606
}
607
 
608
SEMOPS_INLINE QI
609
SUBCQI (QI a, QI b, BI c)
610
{
611
  QI res = SUBQI (a, ADDQI (b, c));
612
  return res;
613
}
614
 
615
SEMOPS_INLINE BI
616
SUBCFQI (QI a, QI b, BI c)
617
{
618
  BI res = ((UQI) a < (UQI) b) || (c && a == b);
619
  return res;
620
}
621
 
622
SEMOPS_INLINE BI
623
SUBOFQI (QI a, QI b, BI c)
624
{
625
  QI tmp = SUBQI (a, ADDQI (b, c));
626
  BI res = (((a < 0) != (b < 0))
627
            && ((a < 0) != (tmp < 0)));
628
  return res;
629
}
630
 
631
#else
632
 
633
SI ADDCSI (SI, SI, BI);
634
UBI ADDCFSI (SI, SI, BI);
635
UBI ADDOFSI (SI, SI, BI);
636
SI SUBCSI (SI, SI, BI);
637
UBI SUBCFSI (SI, SI, BI);
638
UBI SUBOFSI (SI, SI, BI);
639
HI ADDCHI (HI, HI, BI);
640
UBI ADDCFHI (HI, HI, BI);
641
UBI ADDOFHI (HI, HI, BI);
642
HI SUBCHI (HI, HI, BI);
643
UBI SUBCFHI (HI, HI, BI);
644
UBI SUBOFHI (HI, HI, BI);
645
QI ADDCQI (QI, QI, BI);
646
UBI ADDCFQI (QI, QI, BI);
647
UBI ADDOFQI (QI, QI, BI);
648
QI SUBCQI (QI, QI, BI);
649
UBI SUBCFQI (QI, QI, BI);
650
UBI SUBOFQI (QI, QI, BI);
651
 
652
#endif
653
 
654
#endif /* CGEN_SEM_OPS_H */

powered by: WebSVN 2.1.0

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