qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target-arm: fix SMMLA/SMMLS instructions
Date: Wed, 5 Jan 2011 11:15:15 +0000	[thread overview]
Message-ID: <AANLkTima0ZPLfn19a1B_HMi_dz94deMokOpGzuoFFs-M@mail.gmail.com> (raw)
In-Reply-To: <1293906328-8984-1-git-send-email-aurelien@aurel32.net>

On 1 January 2011 18:25, Aurelien Jarno <aurelien@aurel32.net> wrote:
> SMMLA and SMMLS are broken on both in normal and thumb mode, that is
> both (different) implementations are wrong. They try to avoid a 64-bit
> add for the rounding, which is not trivial if you want to support both
> SMMLA and SMMLS with the same code.
>
> The code below uses the same implementation for both modes, using the
> code from the ARM manual. It also fixes the thumb decoding that was a
> mix between normal and thumb mode.
>
> This fixes the issues reported in
> https://bugs.launchpad.net/qemu/+bug/629298

I've tested this patch with my random-sequence-generator for
SMMLA/SMMLS/SMMUL for ARM and Thumb, and it does fix
the bug. I have a few minor nitpicks about some comments, though.

> -/* Round the top 32 bits of a 64-bit value.  */
> -static void gen_roundqd(TCGv a, TCGv b)
> +/* Add a to the msw of b. Mark inputs as dead */
> +static TCGv_i64 gen_addq_msw(TCGv_i64 a, TCGv b)
>  {
> -    tcg_gen_shri_i32(a, a, 31);
> -    tcg_gen_add_i32(a, a, b);
> +    TCGv_i64 tmp64 = tcg_temp_new_i64();
> +
> +    tcg_gen_extu_i32_i64(tmp64, b);
> +    dead_tmp(b);
> +    tcg_gen_shli_i64(tmp64, tmp64, 32);
> +    tcg_gen_add_i64(a, tmp64, a);
> +
> +    tcg_temp_free_i64(tmp64);
> +    return a;
> +}

Isn't this adding b to the msw of a, rather than the other
way round as the comment claims?

> +/* Subtract a from the msw of b. Mark inputs as dead. */

Ditto.

> @@ -6953,23 +6958,25 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
>                     tmp = load_reg(s, rm);
>                     tmp2 = load_reg(s, rs);
>                     if (insn & (1 << 20)) {
> -                        /* Signed multiply most significant [accumulate].  */
> +                        /* Signed multiply most significant [accumulate].
> +                           (SMMUL, SMLA, SMMLS) */

SMMLA, not SMLA.

-- PMM

  reply	other threads:[~2011-01-05 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-01 18:25 [Qemu-devel] [PATCH] target-arm: fix SMMLA/SMMLS instructions Aurelien Jarno
2011-01-05 11:15 ` Peter Maydell [this message]
2011-01-06 15:50   ` Aurelien Jarno
2011-01-06 15:54     ` Peter Maydell
2011-01-06 17:24       ` Aurelien Jarno
2011-01-06 18:09         ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2011-01-06 18:53 Aurelien Jarno

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=AANLkTima0ZPLfn19a1B_HMi_dz94deMokOpGzuoFFs-M@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).