This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
SIM: PATCH: RFA: Rotate semantics for cgen sims
- To: gdb-patches at sources dot redhat dot com, cgen at sources dot redhat dot com
- Subject: SIM: PATCH: RFA: Rotate semantics for cgen sims
- From: Dave Brolley <brolley at redhat dot com>
- Date: Tue, 26 Sep 2000 12:22:18 -0400
- Organization: Red Hat Canada, Inc
Hi,
This patch adds RORQI, ROLQI, RORHI and ROLHI to
sim/common/cgen-utils.c. These functions enable rotate semantics
for QI and HI modes.
OK to commit?
Dave
2000-09-26 Dave Brolley <brolley@redhat.com>
* cgen-utils.c (RORQI): New function.
(ROLQI): New function.
(RORHI): New function.
(ROLHI): New function.
Index: cgen-utils.c
===================================================================
RCS file: /cvs/src/src/sim/common/cgen-utils.c,v
retrieving revision 1.1.1.4
diff -c -p -r1.1.1.4 cgen-utils.c
*** cgen-utils.c 1999/08/31 01:12:04 1.1.1.4
--- cgen-utils.c 2000/09/26 16:09:08
*************** CONVDISI (val)
*** 321,326 ****
--- 321,394 ----
#endif /* DI_FN_SUPPORT */
+ QI
+ RORQI (val, shift)
+ QI val;
+ int shift;
+ {
+ if (shift != 0)
+ {
+ int remain = 8 - shift;
+ int mask = (1 << shift) - 1;
+ QI result = (val & mask) << remain;
+ mask = (1 << remain) - 1;
+ result |= (val >> shift) & mask;
+ return result;
+ }
+ return val;
+ }
+
+ QI
+ ROLQI (val, shift)
+ QI val;
+ int shift;
+ {
+ if (shift != 0)
+ {
+ int remain = 8 - shift;
+ int mask = (1 << remain) - 1;
+ QI result = (val & mask) << shift;
+ mask = (1 << shift) - 1;
+ result |= (val >> remain) & mask;
+ return result;
+ }
+ return val;
+ }
+
+ HI
+ RORHI (val, shift)
+ HI val;
+ int shift;
+ {
+ if (shift != 0)
+ {
+ int remain = 16 - shift;
+ int mask = (1 << shift) - 1;
+ HI result = (val & mask) << remain;
+ mask = (1 << remain) - 1;
+ result |= (val >> shift) & mask;
+ return result;
+ }
+ return val;
+ }
+
+ HI
+ ROLHI (val, shift)
+ HI val;
+ int shift;
+ {
+ if (shift != 0)
+ {
+ int remain = 16 - shift;
+ int mask = (1 << remain) - 1;
+ HI result = (val & mask) << shift;
+ mask = (1 << shift) - 1;
+ result |= (val >> remain) & mask;
+ return result;
+ }
+ return val;
+ }
+
SI
RORSI (val, shift)
SI val;