This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, moxie, sim] Add mul.x and umul.x instruction support
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Anthony Green <green at moxielogic dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 24 Dec 2014 08:43:37 -0500
- Subject: Re: [PATCH, moxie, sim] Add mul.x and umul.x instruction support
- Authentication-results: sourceware.org; auth=none
- References: <87ioh1890s dot fsf at moxielogic dot com>
> 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;
Can you add an empty line after the local variable declarations?
This is part of GDB's Coding Standard...
Also, you appear to have some code in between local variable
declarations, which is not allowed (non C90, I think). Can you fix?
> + }
> + 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;
Same here.
> + }
> + break;
> case 0x16: /* bad */
> case 0x17: /* bad */
> case 0x18: /* bad */
Thank you,
--
Joel