* [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL*
@ 2019-09-12 18:30 Richard Henderson
2019-09-13 6:03 ` Laurent Desnogues
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Richard Henderson @ 2019-09-12 18:30 UTC (permalink / raw)
To: qemu-devel; +Cc: laurent.desnogues, peter.maydell
The 32-bit product should be sign-extended, not zero-extended.
Fixes: ea96b374641b
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 34bb280e3d..fd2f0e3048 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -8045,7 +8045,9 @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a,
case 2:
tl = load_reg(s, a->ra);
th = load_reg(s, a->rd);
- t1 = tcg_const_i32(0);
+ /* Sign-extend the 32-bit product to 64 bits. */
+ t1 = tcg_temp_new_i32();
+ tcg_gen_sari_i32(t1, t0, 31);
tcg_gen_add2_i32(tl, th, tl, th, t0, t1);
tcg_temp_free_i32(t0);
tcg_temp_free_i32(t1);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL*
2019-09-12 18:30 [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL* Richard Henderson
@ 2019-09-13 6:03 ` Laurent Desnogues
2019-09-13 11:01 ` Philippe Mathieu-Daudé
2019-10-14 23:42 ` Richard Henderson
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Desnogues @ 2019-09-13 6:03 UTC (permalink / raw)
To: Richard Henderson; +Cc: Peter Maydell, qemu-devel
Hello,
On Thu, Sep 12, 2019 at 8:31 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The 32-bit product should be sign-extended, not zero-extended.
>
> Fixes: ea96b374641b
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
No more failures on my tests.
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Thanks,
Laurent
> ---
> target/arm/translate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 34bb280e3d..fd2f0e3048 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -8045,7 +8045,9 @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a,
> case 2:
> tl = load_reg(s, a->ra);
> th = load_reg(s, a->rd);
> - t1 = tcg_const_i32(0);
> + /* Sign-extend the 32-bit product to 64 bits. */
> + t1 = tcg_temp_new_i32();
> + tcg_gen_sari_i32(t1, t0, 31);
> tcg_gen_add2_i32(tl, th, tl, th, t0, t1);
> tcg_temp_free_i32(t0);
> tcg_temp_free_i32(t1);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL*
2019-09-12 18:30 [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL* Richard Henderson
2019-09-13 6:03 ` Laurent Desnogues
@ 2019-09-13 11:01 ` Philippe Mathieu-Daudé
2019-10-14 23:42 ` Richard Henderson
2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-13 11:01 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: laurent.desnogues, peter.maydell
On 9/12/19 8:30 PM, Richard Henderson wrote:
> The 32-bit product should be sign-extended, not zero-extended.
>
> Fixes: ea96b374641b
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> target/arm/translate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 34bb280e3d..fd2f0e3048 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -8045,7 +8045,9 @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a,
> case 2:
> tl = load_reg(s, a->ra);
> th = load_reg(s, a->rd);
> - t1 = tcg_const_i32(0);
> + /* Sign-extend the 32-bit product to 64 bits. */
> + t1 = tcg_temp_new_i32();
> + tcg_gen_sari_i32(t1, t0, 31);
> tcg_gen_add2_i32(tl, th, tl, th, t0, t1);
> tcg_temp_free_i32(t0);
> tcg_temp_free_i32(t1);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/arm: Fix sign-extension for SMLAL*
2019-09-12 18:30 [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL* Richard Henderson
2019-09-13 6:03 ` Laurent Desnogues
2019-09-13 11:01 ` Philippe Mathieu-Daudé
@ 2019-10-14 23:42 ` Richard Henderson
2019-10-17 13:52 ` Peter Maydell
2 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2019-10-14 23:42 UTC (permalink / raw)
To: qemu-devel; +Cc: laurent.desnogues, peter.maydell
Ping.
On 9/12/19 11:30 AM, Richard Henderson wrote:
> The 32-bit product should be sign-extended, not zero-extended.
>
> Fixes: ea96b374641b
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/translate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 34bb280e3d..fd2f0e3048 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -8045,7 +8045,9 @@ static bool op_smlaxxx(DisasContext *s, arg_rrrr *a,
> case 2:
> tl = load_reg(s, a->ra);
> th = load_reg(s, a->rd);
> - t1 = tcg_const_i32(0);
> + /* Sign-extend the 32-bit product to 64 bits. */
> + t1 = tcg_temp_new_i32();
> + tcg_gen_sari_i32(t1, t0, 31);
> tcg_gen_add2_i32(tl, th, tl, th, t0, t1);
> tcg_temp_free_i32(t0);
> tcg_temp_free_i32(t1);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] target/arm: Fix sign-extension for SMLAL*
2019-10-14 23:42 ` Richard Henderson
@ 2019-10-17 13:52 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2019-10-17 13:52 UTC (permalink / raw)
To: Richard Henderson; +Cc: Laurent Desnogues, QEMU Developers
On Tue, 15 Oct 2019 at 00:42, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Ping.
>
> On 9/12/19 11:30 AM, Richard Henderson wrote:
> > The 32-bit product should be sign-extended, not zero-extended.
> >
> > Fixes: ea96b374641b
> > Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> > Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-17 14:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 18:30 [Qemu-devel] [PATCH] target/arm: Fix sign-extension for SMLAL* Richard Henderson
2019-09-13 6:03 ` Laurent Desnogues
2019-09-13 11:01 ` Philippe Mathieu-Daudé
2019-10-14 23:42 ` Richard Henderson
2019-10-17 13:52 ` Peter Maydell
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).