qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL for-4.1 1/7] tcg: Fix constant folding of INDEX_op_extract2_i32
Date: Sun, 14 Jul 2019 11:12:43 +0000	[thread overview]
Message-ID: <20190714111249.13859-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190714111249.13859-1-richard.henderson@linaro.org>

On a 64-bit host, discard any replications of the 32-bit
sign bit when performing the shift and merge.

Fixes: https://bugs.launchpad.net/bugs/1834496
Tested-by: Christophe Lyon <christophe.lyon@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/optimize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index d7c71a6085..d2424de4af 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1213,8 +1213,8 @@ void tcg_optimize(TCGContext *s)
                 if (opc == INDEX_op_extract2_i64) {
                     tmp = (v1 >> op->args[3]) | (v2 << (64 - op->args[3]));
                 } else {
-                    tmp = (v1 >> op->args[3]) | (v2 << (32 - op->args[3]));
-                    tmp = (int32_t)tmp;
+                    tmp = (int32_t)(((uint32_t)v1 >> op->args[3]) |
+                                    ((uint32_t)v2 << (32 - op->args[3])));
                 }
                 tcg_opt_gen_movi(s, op, op->args[0], tmp);
                 break;
-- 
2.17.1



  reply	other threads:[~2019-07-14 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-14 11:12 [Qemu-devel] [PULL for-4.1 0/7] tcg patch queue Richard Henderson
2019-07-14 11:12 ` Richard Henderson [this message]
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 2/7] tcg/aarch64: Fix output of extract2 opcodes Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 3/7] include/qemu/atomic.h: Add signal_barrier Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 4/7] tcg: Introduce set/clear_helper_retaddr Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 5/7] tcg: Remove cpu_ld*_code_ra Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 6/7] tcg: Remove duplicate #if !defined(CODE_ACCESS) Richard Henderson
2019-07-14 11:12 ` [Qemu-devel] [PULL for-4.1 7/7] tcg: Release mmap_lock on translation fault Richard Henderson
2019-07-15  9:40 ` [Qemu-devel] [PULL for-4.1 0/7] tcg patch queue Peter Maydell

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=20190714111249.13859-2-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@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).