public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* [RFA] New SUBWORD* functions for SID CPUs
@ 2002-01-31  4:28 Ben Elliston
  2002-01-31  4:35 ` Frank Ch. Eigler
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2002-01-31  4:28 UTC (permalink / raw)
  To: sid; +Cc: cgen

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] New SUBWORD* functions for SID CPUs
  2002-01-31  4:28 [RFA] New SUBWORD* functions for SID CPUs Ben Elliston
@ 2002-01-31  4:35 ` Frank Ch. Eigler
  2002-01-31 17:04   ` Ben Elliston
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2002-01-31  4:35 UTC (permalink / raw)
  To: Ben Elliston; +Cc: sid, cgen

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

Hi -

On Thu, Jan 31, 2002 at 11:28:23PM +1100, Ben Elliston wrote:
> 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?

Of course -- such library build-outs don't need elaborate approvals.
Are you sure though that the SF<->SI routines are meant to consist
of plain coercion (as in truncate-to-int), instead of the equivalent
to
	* (int *) (& a.float.var)
?

- FChE

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] New SUBWORD* functions for SID CPUs
  2002-01-31  4:35 ` Frank Ch. Eigler
@ 2002-01-31 17:04   ` Ben Elliston
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Elliston @ 2002-01-31 17:04 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: sid

>>>>> "FChE" == Frank Ch Eigler <fche@redhat.com> writes:

  FChE> Are you sure though that the SF<->SI routines are meant to consist
  FChE> of plain coercion (as in truncate-to-int), instead of the equivalent
  FChE> to
  FChE> 	* (int *) (& a.float.var)

Oops, right you are -- thanks for pointing that out.  I'll commit my
patch shortly with the necessary changes.

Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-01  1:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31  4:28 [RFA] New SUBWORD* functions for SID CPUs Ben Elliston
2002-01-31  4:35 ` Frank Ch. Eigler
2002-01-31 17:04   ` Ben Elliston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).