aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2000-09-26 17:23:58 +0000
committerDave Brolley <brolley@redhat.com>2000-09-26 17:23:58 +0000
commit6d4c43bfc62a1f237431df1be13ced96d7cade6c (patch)
treee953dbc9c3bb82210e7e2be113d3824617905f0f /sim
parentc78b4128575c657ab87e3170fdd2d63b09a3072f (diff)
downloadgdb-6d4c43bfc62a1f237431df1be13ced96d7cade6c.zip
gdb-6d4c43bfc62a1f237431df1be13ced96d7cade6c.tar.gz
gdb-6d4c43bfc62a1f237431df1be13ced96d7cade6c.tar.bz2
2000-09-26 Dave Brolley <brolley@redhat.com>
* cgen-utils.c (RORQI): New function. (ROLQI): New function. (RORHI): New function. (ROLHI): New function.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/cgen-utils.c68
2 files changed, 75 insertions, 0 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 3f13ea6..4b43e06 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,10 @@
+2000-09-26 Dave Brolley <brolley@redhat.com>
+
+ * cgen-utils.c (RORQI): New function.
+ (ROLQI): New function.
+ (RORHI): New function.
+ (ROLHI): New function.
+
2000-08-28 Dave Brolley <brolley@redhat.com>
* cgen-trace.c (sim_cgen_disassemble_insn): Make sure entire insn is
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index e7407ed..a45804e 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -321,6 +321,74 @@ CONVDISI (val)
#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;