From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Christophe Lyon <christophe.lyon@st.com>, patches@linaro.org
Subject: [Qemu-devel] [PATCH 02/10] target-arm: Fix signed VRSHL by large shift counts
Date: Tue, 15 Feb 2011 13:44:42 +0000 [thread overview]
Message-ID: <1297777490-5323-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1297777490-5323-1-git-send-email-peter.maydell@linaro.org>
Correctly handle VRSHL of signed values by a shift count of the
width of the data type or larger, which must be special-cased in the
rshl_s* helper functions.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/neon_helper.c | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index cc63636..f692640 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -543,14 +543,9 @@ uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop)
#define NEON_FN(dest, src1, src2) do { \
int8_t tmp; \
tmp = (int8_t)src2; \
- if (tmp >= (ssize_t)sizeof(src1) * 8) { \
+ if ((tmp >= (ssize_t)sizeof(src1) * 8) \
+ || (tmp <= -(ssize_t)sizeof(src1) * 8)) { \
dest = 0; \
- } else if (tmp < -(ssize_t)sizeof(src1) * 8) { \
- dest = src1 >> (sizeof(src1) * 8 - 1); \
- } else if (tmp == -(ssize_t)sizeof(src1) * 8) { \
- dest = src1 >> (tmp - 1); \
- dest++; \
- dest >>= 1; \
} else if (tmp < 0) { \
dest = (src1 + (1 << (-1 - tmp))) >> -tmp; \
} else { \
@@ -584,14 +579,8 @@ uint64_t HELPER(neon_rshl_s64)(uint64_t valop, uint64_t shiftop)
{
int8_t shift = (int8_t)shiftop;
int64_t val = valop;
- if (shift >= 64) {
+ if ((shift >= 64) || (shift <= -64)) {
val = 0;
- } else if (shift < -64) {
- val >>= 63;
- } else if (shift == -63) {
- val >>= 63;
- val++;
- val >>= 1;
} else if (shift < 0) {
val >>= (-shift - 1);
if (val == INT64_MAX) {
--
1.7.1
next prev parent reply other threads:[~2011-02-15 13:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 13:44 [Qemu-devel] [PATCH 00/10] Fix Neon shift instructions Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 01/10] target-arm: Fix rounding constant addition for Neon shifts Peter Maydell
2011-02-15 13:44 ` Peter Maydell [this message]
2011-02-15 13:44 ` [Qemu-devel] [PATCH 03/10] target-arm: Fix unsigned VRSHL.s8 and .s16 right shifts by type width Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 04/10] target-arm: fix unsigned 64 bit right shifts Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 05/10] target-arm: Fix saturated values for Neon " Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 06/10] target-arm: fix Neon VQSHRN and VSHRN Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 07/10] target-arm: fix decoding of Neon 64 bit shifts Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 08/10] target-arm: Fix signed VQRSHL by large shift counts Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 09/10] target-arm: Fix unsigned " Peter Maydell
2011-02-15 13:44 ` [Qemu-devel] [PATCH 10/10] target-arm: Fix shift by immediate and narrow where src, dest overlap Peter Maydell
2011-02-20 16:52 ` Aurelien Jarno
2011-02-15 16:35 ` [Qemu-devel] Re: [PATCH 00/10] Fix Neon shift instructions Christophe Lyon
2011-02-20 16:52 ` [Qemu-devel] " 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=1297777490-5323-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=christophe.lyon@st.com \
--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).