This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
[RFA] New SUBWORD* functions for SID CPUs
- From: Ben Elliston <bje at redhat dot com>
- To: sid at sources dot redhat dot com
- Cc: cgen at sources dot redhat dot com
- Date: Thu, 31 Jan 2002 23:28:23 +1100 (EST)
- Subject: [RFA] New SUBWORD* functions for SID CPUs
The following patch adds a number of new mode conversion functions for
SID CPU components. Some, such as SUBWORDSISF, simply perform
coercion between modes. Okay to commit?
Ben
2002-01-31 Ben Elliston <bje@redhat.com>
* cgen-ops.h (SUBWORDSIQI): New.
(SUBWORDSIHI): Ditto.
(SUBWORDSFSI): Ditto.
(SUBWORDSISF): Ditto.
(SUBWORDDIDF): Ditto.
(SUBWORDDFSI): Ditto.
(SUBWORDSIUQI): Ditto.
Index: cgen-ops.h
===================================================================
RCS file: /cvs/cvsfiles/devo/sid/component/cgen-cpu/cgen-ops.h,v
retrieving revision 1.21
diff -u -c -r1.21 cgen-ops.h
*** cgen-ops.h 2001/12/18 23:07:59 1.21
--- cgen-ops.h 2002/01/31 12:22:10
***************
*** 1,6 ****
// cgen-ops.h - CGEN semantic ops. -*- C++ -*-
! // Copyright (C) 1999, 2000 Red Hat.
// This file is part of SID and is licensed under the GPL.
// See the file COPYING.SID for conditions for redistribution.
--- 1,6 ----
// cgen-ops.h - CGEN semantic ops. -*- C++ -*-
! // Copyright (C) 1999, 2000, 2002 Red Hat.
// This file is part of SID and is licensed under the GPL.
// See the file COPYING.SID for conditions for redistribution.
***************
*** 503,508 ****
--- 503,559 ----
return res;
}
+ inline QI
+ SUBWORDSIQI (SI in, int byte)
+ {
+ assert (byte >= 0 && byte <= 3);
+ return static_cast<UQI> ((in >> (8 * (3 - byte))) & 0xFF);
+ }
+
+
+ inline HI
+ SUBWORDSIHI (SI in, int word)
+ {
+ if (word == 0)
+ return static_cast<USI> (in >> 16);
+ else
+ return in;
+ }
+
+ inline SI
+ SUBWORDSFSI (SF in)
+ {
+ SI out = in;
+ return out;
+ }
+
+ inline SF
+ SUBWORDSISF (SI in)
+ {
+ SF out = in;
+ return out;
+ }
+
+ inline DF
+ SUBWORDDIDF (DI in)
+ {
+ DF out = in;
+ return out;
+ }
+
+ inline SI
+ SUBWORDDFSI (DF in, int word)
+ {
+ DI di = in;
+ return SUBWORDDISI(di, word);
+ }
+
+ inline UQI
+ SUBWORDSIUQI (SI in, int byte)
+ {
+ assert (byte >= 0 && byte <= 7);
+ return static_cast<UQI> ((in >> (8 * (3 - byte))) & 0xFF);
+ }
} // namespace cgen