1- /* Semantics ops support for CGEN-based opcode libraries .
2- Copyright (C) 2005, 2007 Free Software Foundation, Inc.
1+ /* Basic semantics ops support for CGEN.
2+ Copyright 2005, 2007, 2009 Free Software Foundation, Inc.
33 Contributed by Red Hat.
44
55 This file is part of the GNU opcodes library.
66
7- This program is free software; you can redistribute it and/or modify
7+ This library is free software; you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
99 the Free Software Foundation; either version 3, or (at your option)
1010 any later version.
1111
12- It is distributed in the hope that it will be useful, but WITHOUT
13- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15- License for more details.
12+ It is distributed in the hope that it will be useful,
13+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ GNU General Public License for more details.
1616
17- You should have received a copy of the GNU General Public License along
18- with this program; if not, write to the Free Software Foundation, Inc.,
19- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17+ You should have received a copy of the GNU General Public License
18+ along with this library; see the file COPYING3. If not, write to the
19+ Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20+ 02110-1301, USA. */
2021
21- #ifndef CGEN_SEM_OPS_H
22- #define CGEN_SEM_OPS_H
22+ #ifndef CGEN_BASIC_OPS_H
23+ #define CGEN_BASIC_OPS_H
2324
2425#include <assert.h>
2526
3031#define SEMOPS_INLINE
3132#endif
3233
33- /* TODO: Lazy encoding/decoding of fp values. */
34-
3534/* These don't really have a mode. */
3635#define ANDIF (x , y ) ((x) && (y))
3736#define ORIF (x , y ) ((x) || (y))
@@ -298,50 +297,26 @@ extern SI TRUNCDISI (DI);
298297
299298QI SUBWORDSIQI (SI , int );
300299HI SUBWORDSIHI (SI , int );
301- SI SUBWORDSFSI (SF );
302- SF SUBWORDSISF (SI );
303- DI SUBWORDDFDI (DF );
304- DF SUBWORDDIDF (DI );
305300QI SUBWORDDIQI (DI , int );
306301HI SUBWORDDIHI (DI , int );
307302SI SUBWORDDISI (DI , int );
308- SI SUBWORDDFSI (DF , int );
309- SI SUBWORDXFSI (XF , int );
310- SI SUBWORDTFSI (TF , int );
311-
312- UQI SUBWORDSIUQI (SI , int );
313- UQI SUBWORDDIUQI (DI , int );
314303
315304#ifdef SEMOPS_DEFINE_INLINE
316305
317- SEMOPS_INLINE SF
318- SUBWORDSISF (SI in )
319- {
320- union { SI in ; SF out ; } x ;
321- x .in = in ;
322- return x .out ;
323- }
324-
325- SEMOPS_INLINE DF
326- SUBWORDDIDF (DI in )
327- {
328- union { DI in ; DF out ; } x ;
329- x .in = in ;
330- return x .out ;
331- }
332-
333306SEMOPS_INLINE QI
334307SUBWORDSIQI (SI in , int byte )
335308{
336309 assert (byte >= 0 && byte <= 3 );
337310 return (UQI ) (in >> (8 * (3 - byte ))) & 0xFF ;
338311}
339312
340- SEMOPS_INLINE UQI
341- SUBWORDSIUQI (SI in , int byte )
313+ SEMOPS_INLINE HI
314+ SUBWORDSIHI (SI in , int word )
342315{
343- assert (byte >= 0 && byte <= 3 );
344- return (UQI ) (in >> (8 * (3 - byte ))) & 0xFF ;
316+ if (word == 0 )
317+ return (USI ) in >> 16 ;
318+ else
319+ return in ;
345320}
346321
347322SEMOPS_INLINE QI
@@ -358,38 +333,6 @@ SUBWORDDIHI (DI in, int word)
358333 return (UHI ) (in >> (16 * (3 - word ))) & 0xFFFF ;
359334}
360335
361- SEMOPS_INLINE HI
362- SUBWORDSIHI (SI in , int word )
363- {
364- if (word == 0 )
365- return (USI ) in >> 16 ;
366- else
367- return in ;
368- }
369-
370- SEMOPS_INLINE SI
371- SUBWORDSFSI (SF in )
372- {
373- union { SF in ; SI out ; } x ;
374- x .in = in ;
375- return x .out ;
376- }
377-
378- SEMOPS_INLINE DI
379- SUBWORDDFDI (DF in )
380- {
381- union { DF in ; DI out ; } x ;
382- x .in = in ;
383- return x .out ;
384- }
385-
386- SEMOPS_INLINE UQI
387- SUBWORDDIUQI (DI in , int byte )
388- {
389- assert (byte >= 0 && byte <= 7 );
390- return (UQI ) (in >> (8 * (7 - byte )));
391- }
392-
393336SEMOPS_INLINE SI
394337SUBWORDDISI (DI in , int word )
395338{
@@ -399,34 +342,6 @@ SUBWORDDISI (DI in, int word)
399342 return in ;
400343}
401344
402- SEMOPS_INLINE SI
403- SUBWORDDFSI (DF in , int word )
404- {
405- /* Note: typedef UDI DF; */
406- if (word == 0 )
407- return (UDI ) in >> 32 ;
408- else
409- return in ;
410- }
411-
412- SEMOPS_INLINE SI
413- SUBWORDXFSI (XF in , int word )
414- {
415- /* Note: typedef struct { SI parts[3]; } XF; */
416- union { XF in ; SI out [3 ]; } x ;
417- x .in = in ;
418- return x .out [word ];
419- }
420-
421- SEMOPS_INLINE SI
422- SUBWORDTFSI (TF in , int word )
423- {
424- /* Note: typedef struct { SI parts[4]; } TF; */
425- union { TF in ; SI out [4 ]; } x ;
426- x .in = in ;
427- return x .out [word ];
428- }
429-
430345#endif /* SUBWORD,JOIN */
431346
432- #endif /* CGEN_SEM_OPS_H */
347+ #endif /* CGEN_BASIC_OPS_H */
0 commit comments