Re: [PATCH][RX] v2 instructions support

Mike Frysinger
2015-12-24T07:35:58Z

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

On 22 Dec 2015 02:34, Yoshinori Sato wrote:
> --- a/sim/rx/fpu.c
> +++ b/sim/rx/fpu.c
>
> +double sqrt(double x);

never declare your own prototype for system funcs. include math.h instead.

> +static FP_ExceptionCases ex_sqrt_tab[5][5] = {

please constify this. you might have to update check_exceptions too.

> + tprintf("sqrt(%g) = %g\n", da, sqrt(da));

space before the (. this comes up a few times in your patch, so please
fix them all.

> + /* Less than 0.49999 */

period at the end and two spaces:
/* Less than 0.49999. */

this comes up a few times in your patch, so please fix them all.

> + if (rx_big_endian)
> + {
> + put_be (buf, 8, acc.lo);
> + }
> + else
> + {
> + put_le (buf, 8, acc.lo);
> + }

no need for braces here

> + for(i = 0; i < 2; i++)

space before the (

> {
> - if (tag) { printf (tag); tag = 0; }
> - printf(" acc %016llx:", oldregs.r_acc);
> - printf("%016llx", regs.r_acc);
> - oldregs.r_acc = regs.r_acc;
> + if (oldregs.r_acc[i].hi != regs.r_acc[i].hi ||
> + oldregs.r_acc[i].lo != regs.r_acc[i].lo)
> + {
> + if (tag) { printf (tag); tag = 0; }
> + printf(" acc%d %08x%016lx:", i, oldregs.r_acc[i].hi,
> + oldregs.r_acc[i].lo);
> + printf("%08x%016lx", regs.r_acc[i].hi,
> + oldregs.r_acc[i].lo);
> + oldregs.r_acc[i] = regs.r_acc[i];
> + }

i know you aren't writing this code, but please fix the style in the process.

> +#define MULADD(val, s) \

the trailing \ style in these macros is inconsistent. if you don't want to
align them to 80 cols, then just put one space before them.
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]