Patchwork target-mips: fix for sign-issue in MULQ_W helper

login
register
mail settings
Submitter Petar Jovanovic
Date Feb. 7, 2013, 6:36 p.m.
Message ID <1360262169-823-1-git-send-email-petar.jovanovic@rt-rk.com>
Download mbox | patch
Permalink /patch/218975/
State New
Headers show

Comments

Petar Jovanovic - Feb. 7, 2013, 6:36 p.m.
From: Petar Jovanovic <petarj@mips.com>

Correct sign-propagation before multiplication in MULQ_W helper.
The change also fixes previously incorrect expected values in the
tests for MULQ_RS.W and MULQ_S.W.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
---
 target-mips/dsp_helper.c                |    2 +-
 tests/tcg/mips/mips32-dspr2/mulq_rs_w.c |    2 +-
 tests/tcg/mips/mips32-dspr2/mulq_s_w.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Richard Henderson - Feb. 8, 2013, 5:40 p.m.
On 2013-02-07 10:36, Petar Jovanovic wrote:
> From: Petar Jovanovic <petarj@mips.com>
>
> Correct sign-propagation before multiplication in MULQ_W helper.
> The change also fixes previously incorrect expected values in the
> tests for MULQ_RS.W and MULQ_S.W.
>
> Signed-off-by: Petar Jovanovic <petarj@mips.com>
> ---
>   target-mips/dsp_helper.c                |    2 +-
>   tests/tcg/mips/mips32-dspr2/mulq_rs_w.c |    2 +-
>   tests/tcg/mips/mips32-dspr2/mulq_s_w.c  |    2 +-
>   3 files changed, 3 insertions(+), 3 deletions(-)


Reviewed-by: Richard Henderson <rth@twiddle.net>


r~
Petar Jovanovic - Feb. 20, 2013, 4:24 p.m.
ping
http://patchwork.ozlabs.org/patch/218975/
Aurelien Jarno - Feb. 23, 2013, 10:54 p.m.
On Thu, Feb 07, 2013 at 07:36:09PM +0100, Petar Jovanovic wrote:
> From: Petar Jovanovic <petarj@mips.com>
> 
> Correct sign-propagation before multiplication in MULQ_W helper.
> The change also fixes previously incorrect expected values in the
> tests for MULQ_RS.W and MULQ_S.W.
> 
> Signed-off-by: Petar Jovanovic <petarj@mips.com>
> ---
>  target-mips/dsp_helper.c                |    2 +-
>  tests/tcg/mips/mips32-dspr2/mulq_rs_w.c |    2 +-
>  tests/tcg/mips/mips32-dspr2/mulq_s_w.c  |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
> index 96cb044..c718707 100644
> --- a/target-mips/dsp_helper.c
> +++ b/target-mips/dsp_helper.c
> @@ -2689,7 +2689,7 @@ MAQ_SA_W(maq_sa_w_phr, 0);
>  target_ulong helper_##name(target_ulong rs, target_ulong rt,   \
>                             CPUMIPSState *env)                  \
>  {                                                              \
> -    uint32_t rs_t, rt_t;                                       \
> +    int32_t rs_t, rt_t;                                        \
>      int32_t tempI;                                             \
>      int64_t tempL;                                             \
>                                                                 \
> diff --git a/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c b/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
> index 669405f..7ba633b 100644
> --- a/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
> +++ b/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
> @@ -8,7 +8,7 @@ int main()
>  
>      rs = 0x80001234;
>      rt = 0x80004321;
> -    result = 0x80005555;
> +    result = 0x7FFFAAAB;
>  
>      __asm
>          ("mulq_rs.w %0, %1, %2\n\t"
> diff --git a/tests/tcg/mips/mips32-dspr2/mulq_s_w.c b/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
> index df148b7..9c2be06 100644
> --- a/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
> +++ b/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
> @@ -8,7 +8,7 @@ int main()
>  
>      rs = 0x80001234;
>      rt = 0x80004321;
> -    result = 0x80005555;
> +    result = 0x7FFFAAAB;
>  
>      __asm
>          ("mulq_s.w %0, %1, %2\n\t"

Thanks, applied.

Patch

diff --git a/target-mips/dsp_helper.c b/target-mips/dsp_helper.c
index 96cb044..c718707 100644
--- a/target-mips/dsp_helper.c
+++ b/target-mips/dsp_helper.c
@@ -2689,7 +2689,7 @@  MAQ_SA_W(maq_sa_w_phr, 0);
 target_ulong helper_##name(target_ulong rs, target_ulong rt,   \
                            CPUMIPSState *env)                  \
 {                                                              \
-    uint32_t rs_t, rt_t;                                       \
+    int32_t rs_t, rt_t;                                        \
     int32_t tempI;                                             \
     int64_t tempL;                                             \
                                                                \
diff --git a/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c b/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
index 669405f..7ba633b 100644
--- a/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
+++ b/tests/tcg/mips/mips32-dspr2/mulq_rs_w.c
@@ -8,7 +8,7 @@  int main()
 
     rs = 0x80001234;
     rt = 0x80004321;
-    result = 0x80005555;
+    result = 0x7FFFAAAB;
 
     __asm
         ("mulq_rs.w %0, %1, %2\n\t"
diff --git a/tests/tcg/mips/mips32-dspr2/mulq_s_w.c b/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
index df148b7..9c2be06 100644
--- a/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
+++ b/tests/tcg/mips/mips32-dspr2/mulq_s_w.c
@@ -8,7 +8,7 @@  int main()
 
     rs = 0x80001234;
     rt = 0x80004321;
-    result = 0x80005555;
+    result = 0x7FFFAAAB;
 
     __asm
         ("mulq_s.w %0, %1, %2\n\t"