aboutsummaryrefslogtreecommitdiff
path: root/sim/v850/simops.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-01-28 10:06:51 +0000
committerNick Clifton <nickc@redhat.com>2013-01-28 10:06:51 +0000
commit67d7515b0a3ee2a48b6dc9389c1145c37d4b6c47 (patch)
treebffbf46db2699ea0e3e32eee74f662e1bc1d1d65 /sim/v850/simops.c
parent5dddde8e64ce7587714eb04580ee29c2cc93c8f0 (diff)
downloadgdb-67d7515b0a3ee2a48b6dc9389c1145c37d4b6c47.zip
gdb-67d7515b0a3ee2a48b6dc9389c1145c37d4b6c47.tar.gz
gdb-67d7515b0a3ee2a48b6dc9389c1145c37d4b6c47.tar.bz2
* simops.c (v850_rotl): New function.
(v850_bins): New function. * simops.h: Add prototypes fir v850_rotl and v850_bins. * v850-dc: Add entries for V850e3v5. * v850.igen: Add support for v850e3v5. (ld.dw, st.dw, rotl, bins): New patterns.
Diffstat (limited to 'sim/v850/simops.c')
-rw-r--r--sim/v850/simops.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/sim/v850/simops.c b/sim/v850/simops.c
index f7fc67d..da6da59 100644
--- a/sim/v850/simops.c
+++ b/sim/v850/simops.c
@@ -3281,6 +3281,56 @@ void v850_shl(SIM_DESC sd, unsigned int op0, unsigned int op1, unsigned int *op2
*op2p = result;
}
+void
+v850_rotl (SIM_DESC sd, unsigned int amount, unsigned int src, unsigned int * dest)
+{
+ unsigned int result, z, s, cy;
+
+ amount &= 0x1f;
+ result = src << amount;
+ result |= src >> (32 - amount);
+
+ /* Compute the condition codes. */
+ z = (result == 0);
+ s = (result & 0x80000000);
+ cy = ! (result & 1);
+
+ /* Store the result and condition codes. */
+ PSW &= ~(PSW_Z | PSW_S | PSW_OV | PSW_CY);
+ PSW |= ((z ? PSW_Z : 0) | (s ? PSW_S : 0)
+ | (cy ? PSW_CY : 0));
+
+ * dest = result;
+}
+
+void
+v850_bins (SIM_DESC sd, unsigned int source, unsigned int lsb, unsigned int msb,
+ unsigned int * dest)
+{
+ unsigned int mask;
+ unsigned int result, pos, width;
+ unsigned int z, s;
+
+ pos = lsb;
+ width = (msb - lsb) + 1;
+
+ mask = ~ (-1 << width);
+ source &= mask;
+ mask <<= pos;
+ result = (* dest) & ~ mask;
+ result |= source << pos;
+
+ /* Compute the condition codes. */
+ z = (result == 0);
+ s = result & 0x80000000;
+
+ /* Store the result and condition codes. */
+ PSW &= ~(PSW_Z | PSW_S | PSW_OV );
+ PSW |= (z ? PSW_Z : 0) | (s ? PSW_S : 0);
+
+ * dest = result;
+}
+
void v850_shr(SIM_DESC sd, unsigned int op0, unsigned int op1, unsigned int *op2p)
{
unsigned int result, z, s, cy;