public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Anthony Green <green@moxielogic.com>
To: gdb-patches@sourceware.org
Subject: [PATCH, moxie, sim] Add mul.x and umul.x instruction support
Date: Wed, 24 Dec 2014 13:36:00 -0000	[thread overview]
Message-ID: <87ioh1890s.fsf@moxielogic.com> (raw)


This patch adds support for the new mul.x and umul.x instructions for
the moxie simulator.  I'm checking this in.

Thanks,

AG


From sim/moxie/ChangeLog

2014-12-24  Anthony Green  <green@moxielogic.com>

	* interp.c (sim_resume): Add mul.x and umul.x instructions.


diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index fdb6528..f57d166 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -622,8 +622,30 @@ sim_resume (sd, step, siggnal)
 		cpu.asregs.regs[a] = (int) bv & 0xffff;
 	      }
 	      break;
-	    case 0x14: /* bad */
-	    case 0x15: /* bad */
+	    case 0x14: /* mul.x */
+	      {
+		int a = (inst >> 4) & 0xf;
+		int b = inst & 0xf;
+		unsigned av = cpu.asregs.regs[a];
+		unsigned bv = cpu.asregs.regs[b];
+		TRACE("mul.x");
+		signed long long r = 
+		  (signed long long) av * (signed long long) bv;
+		cpu.asregs.regs[a] = r >> 32;
+	      }
+	      break;
+	    case 0x15: /* umul.x */
+	      {
+		int a = (inst >> 4) & 0xf;
+		int b = inst & 0xf;
+		unsigned av = cpu.asregs.regs[a];
+		unsigned bv = cpu.asregs.regs[b];
+		TRACE("umul.x");
+		unsigned long long r = 
+		  (unsigned long long) av * (unsigned long long) bv;
+		cpu.asregs.regs[a] = r >> 32;
+	      }
+	      break;
 	    case 0x16: /* bad */
 	    case 0x17: /* bad */
 	    case 0x18: /* bad */

             reply	other threads:[~2014-12-24 13:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-24 13:36 Anthony Green [this message]
2014-12-24 13:43 ` Joel Brobecker
2014-12-24 17:03   ` Doug Evans
2014-12-24 17:12     ` Joel Brobecker
2014-12-25 13:26   ` Anthony Green
2014-12-26 14:17     ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ioh1890s.fsf@moxielogic.com \
    --to=green@moxielogic.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).