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, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] target-arm: Don't overflow when calculating value for signed VABAL
Date: Tue, 12 Apr 2011 23:31:20 +0100	[thread overview]
Message-ID: <BANLkTi=Jxn2fSQ1uwh579NPn=p-5=9nq6Q@mail.gmail.com> (raw)
In-Reply-To: <20110412213215.GA14070@volta.aurel32.net>

On 12 April 2011 22:32, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Mon, Apr 11, 2011 at 04:32:08PM +0100, Peter Maydell wrote:

>> @@ -1524,12 +1528,12 @@ uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b)
>>  {
>>      uint64_t tmp;
>>      uint64_t result;
>> -    DO_ABD(result, a, b, uint8_t);
>> -    DO_ABD(tmp, a >> 8, b >> 8, uint8_t);
>> +    DO_ABD(result, a, b, uint8_t, uint32_t);
>> +    DO_ABD(tmp, a >> 8, b >> 8, uint8_t, uint32_t);
>>      result |= tmp << 16;
>> -    DO_ABD(tmp, a >> 16, b >> 16, uint8_t);
>> +    DO_ABD(tmp, a >> 16, b >> 16, uint8_t, uint32_t);
>>      result |= tmp << 32;
>> -    DO_ABD(tmp, a >> 24, b >> 24, uint8_t);
>> +    DO_ABD(tmp, a >> 24, b >> 24, uint8_t, uint32_t);
>>      result |= tmp << 48;
>>      return result;
>>  }
>
> Do we really need a 32-bit type for the computation here?

No, anything wider than 8 will do, but my guess was that in
practice 32 bits would be fractionally more efficient than
unnecessarily forcing 16 bit arithmetic. For that matter I
guess we could just say "int" and "unsigned int" since C
guarantees us at least 16 bits there.

-- PMM

  reply	other threads:[~2011-04-13  1:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 15:32 [Qemu-devel] [PATCH] target-arm: Don't overflow when calculating value for signed VABAL Peter Maydell
2011-04-12 21:32 ` Aurelien Jarno
2011-04-12 22:31   ` Peter Maydell [this message]
2011-04-13 20:45     ` 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='BANLkTi=Jxn2fSQ1uwh579NPn=p-5=9nq6Q@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=patches@linaro.org \
    --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).