All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christophe Lyon <christophe.lyon@st.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 10/10] target-arm: Fix shift by immediate and narrow where src, dest overlap
Date: Sun, 20 Feb 2011 17:52:14 +0100	[thread overview]
Message-ID: <20110220165214.GI18619@volta.aurel32.net> (raw)
In-Reply-To: <1297777490-5323-11-git-send-email-peter.maydell@linaro.org>

On Tue, Feb 15, 2011 at 01:44:50PM +0000, Peter Maydell wrote:
> For Neon shifts by immediate and narrow, correctly handle the case
> where the source registers and the destination registers overlap
> (the second pass should use the original register contents, not the
> results of the first pass).
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/translate.c |   38 +++++++++++++++++++++++++++-----------
>  1 files changed, 27 insertions(+), 11 deletions(-)

That looks correct, but it makes GCC (tested 4.3 to 4.6) complaining:

| cc1: warnings being treated as errors
| qemu/target-arm/translate.c: In function ‘disas_neon_data_insn’:
| qemu/target-arm/translate.c:4185: error: ‘tmp4’ may be used uninitialized in this function
| qemu/target-arm/translate.c:4185: error: ‘tmp5’ may be used uninitialized in this function

For a quick look, it seems to be a GCC issue, but we have no other 
choices than workarouding it.

> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index a02b20f..4d5d305 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -4839,31 +4839,47 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
>                      abort();
>                  }
>  
> +                if (size == 3) {
> +                    neon_load_reg64(cpu_V0, rm);
> +                    neon_load_reg64(cpu_V1, rm + 1);
> +                } else {
> +                    tmp4 = neon_load_reg(rm + 1, 0);
> +                    tmp5 = neon_load_reg(rm + 1, 1);
> +                }
>                  for (pass = 0; pass < 2; pass++) {
>                      if (size == 3) {
> -                        neon_load_reg64(cpu_V0, rm + pass);
> +                        TCGv_i64 in;
> +                        if (pass == 0) {
> +                            in = cpu_V0;
> +                        } else {
> +                            in = cpu_V1;
> +                        }
>                          if (q) {
>                              if (input_unsigned) {
> -                                gen_helper_neon_rshl_u64(cpu_V0, cpu_V0,
> -                                                         tmp64);
> +                                gen_helper_neon_rshl_u64(cpu_V0, in, tmp64);
>                              } else {
> -                                gen_helper_neon_rshl_s64(cpu_V0, cpu_V0,
> -                                                         tmp64);
> +                                gen_helper_neon_rshl_s64(cpu_V0, in, tmp64);
>                              }
>                          } else {
>                              if (input_unsigned) {
> -                                gen_helper_neon_shl_u64(cpu_V0, cpu_V0,
> -                                                        tmp64);
> +                                gen_helper_neon_shl_u64(cpu_V0, in, tmp64);
>                              } else {
> -                                gen_helper_neon_shl_s64(cpu_V0, cpu_V0,
> -                                                        tmp64);
> +                                gen_helper_neon_shl_s64(cpu_V0, in, tmp64);
>                              }
>                          }
>                      } else {
> -                        tmp = neon_load_reg(rm + pass, 0);
> +                        if (pass == 0) {
> +                            tmp = neon_load_reg(rm, 0);
> +                        } else {
> +                            tmp = tmp4;
> +                        }
>                          gen_neon_shift_narrow(size, tmp, tmp2, q,
>                                                input_unsigned);
> -                        tmp3 = neon_load_reg(rm + pass, 1);
> +                        if (pass == 0) {
> +                            tmp3 = neon_load_reg(rm, 1);
> +                        } else {
> +                            tmp3 = tmp5;
> +                        }
>                          gen_neon_shift_narrow(size, tmp3, tmp2, q,
>                                                input_unsigned);
>                          tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);
> -- 
> 1.7.1
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2011-02-20 16:52 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 ` [Qemu-devel] [PATCH 02/10] target-arm: Fix signed VRSHL by large shift counts Peter Maydell
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 [this message]
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=20110220165214.GI18619@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=christophe.lyon@st.com \
    --cc=patches@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.