qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL
@ 2011-02-11 12:26 Peter Maydell
  2011-02-11 12:26 ` [Qemu-devel] [PATCH 1/2] target-arm: Refactor handling of VQDMULL Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2011-02-11 12:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

This patch series fixes the Neon VQDMLSL instruction, which was
incorrectly doing the negation step before saturation rather than
afterwards. Patch 1 is a minor cleanup to the affected code area
before patch 2 which is the fix proper.

Tested with the usual random instruction sequences.

Peter Maydell (2):
  target-arm: Refactor handling of VQDMULL
  target-arm: Fix Neon VQDMLSL instruction

 target-arm/translate.c |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] target-arm: Refactor handling of VQDMULL
  2011-02-11 12:26 [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Peter Maydell
@ 2011-02-11 12:26 ` Peter Maydell
  2011-02-11 12:26 ` [Qemu-devel] [PATCH 2/2] target-arm: Fix Neon VQDMLSL instruction Peter Maydell
  2011-02-20 16:29 ` [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-02-11 12:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

Refactor the handling of VQDMULL so that it is dealt with in
its own if() case rather than together with the accumulating
instructions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/translate.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 3087a5d..cf5c3f0 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -5129,16 +5129,16 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                     default: /* 15 is RESERVED.  */
                         return 1;
                     }
-                    if (op == 5 || op == 13 || (op >= 8 && op <= 11)) {
+                    if (op == 13) {
+                        /* VQDMULL */
+                        gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
+                        neon_store_reg64(cpu_V0, rd + pass);
+                    } else if (op == 5 || (op >= 8 && op <= 11)) {
                         /* Accumulate.  */
                         if (op == 10 || op == 11) {
                             gen_neon_negl(cpu_V0, size);
                         }
-
-                        if (op != 13) {
-                            neon_load_reg64(cpu_V1, rd + pass);
-                        }
-
+                        neon_load_reg64(cpu_V1, rd + pass);
                         switch (op) {
                         case 5: case 8: case 10: /* VABAL, VMLAL, VMLSL */
                             gen_neon_addl(size);
@@ -5147,10 +5147,6 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                             gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
                             gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
                             break;
-                            /* Fall through.  */
-                        case 13: /* VQDMULL */
-                            gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
-                            break;
                         default:
                             abort();
                         }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] target-arm: Fix Neon VQDMLSL instruction
  2011-02-11 12:26 [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Peter Maydell
  2011-02-11 12:26 ` [Qemu-devel] [PATCH 1/2] target-arm: Refactor handling of VQDMULL Peter Maydell
@ 2011-02-11 12:26 ` Peter Maydell
  2011-02-20 16:29 ` [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-02-11 12:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

For VQDMLSL, negation has to occur after saturation, not before.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/translate.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/target-arm/translate.c b/target-arm/translate.c
index cf5c3f0..2db2544 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -5135,16 +5135,19 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                         neon_store_reg64(cpu_V0, rd + pass);
                     } else if (op == 5 || (op >= 8 && op <= 11)) {
                         /* Accumulate.  */
-                        if (op == 10 || op == 11) {
-                            gen_neon_negl(cpu_V0, size);
-                        }
                         neon_load_reg64(cpu_V1, rd + pass);
                         switch (op) {
-                        case 5: case 8: case 10: /* VABAL, VMLAL, VMLSL */
+                        case 10: /* VMLSL */
+                            gen_neon_negl(cpu_V0, size);
+                            /* Fall through */
+                        case 5: case 8: /* VABAL, VMLAL */
                             gen_neon_addl(size);
                             break;
                         case 9: case 11: /* VQDMLAL, VQDMLSL */
                             gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
+                            if (op == 11) {
+                                gen_neon_negl(cpu_V0, size);
+                            }
                             gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
                             break;
                         default:
@@ -5282,18 +5285,21 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                             tmp2 = tmp4;
                         }
                         gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
-                        if (op == 6 || op == 7) {
-                            gen_neon_negl(cpu_V0, size);
-                        }
                         if (op != 11) {
                             neon_load_reg64(cpu_V1, rd + pass);
                         }
                         switch (op) {
-                        case 2: case 6:
+                        case 6:
+                            gen_neon_negl(cpu_V0, size);
+                            /* Fall through */
+                        case 2:
                             gen_neon_addl(size);
                             break;
                         case 3: case 7:
                             gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
+                            if (op == 7) {
+                                gen_neon_negl(cpu_V0, size);
+                            }
                             gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
                             break;
                         case 10:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL
  2011-02-11 12:26 [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Peter Maydell
  2011-02-11 12:26 ` [Qemu-devel] [PATCH 1/2] target-arm: Refactor handling of VQDMULL Peter Maydell
  2011-02-11 12:26 ` [Qemu-devel] [PATCH 2/2] target-arm: Fix Neon VQDMLSL instruction Peter Maydell
@ 2011-02-20 16:29 ` Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-02-20 16:29 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On Fri, Feb 11, 2011 at 12:26:46PM +0000, Peter Maydell wrote:
> This patch series fixes the Neon VQDMLSL instruction, which was
> incorrectly doing the negation step before saturation rather than
> afterwards. Patch 1 is a minor cleanup to the affected code area
> before patch 2 which is the fix proper.
> 
> Tested with the usual random instruction sequences.
> 
> Peter Maydell (2):
>   target-arm: Refactor handling of VQDMULL
>   target-arm: Fix Neon VQDMLSL instruction
> 
>  target-arm/translate.c |   38 ++++++++++++++++++++------------------
>  1 files changed, 20 insertions(+), 18 deletions(-)
> 

Thanks, both applied.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-20 16:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-11 12:26 [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Peter Maydell
2011-02-11 12:26 ` [Qemu-devel] [PATCH 1/2] target-arm: Refactor handling of VQDMULL Peter Maydell
2011-02-11 12:26 ` [Qemu-devel] [PATCH 2/2] target-arm: Fix Neon VQDMLSL instruction Peter Maydell
2011-02-20 16:29 ` [Qemu-devel] [PATCH 0/2] target-arm: Fix VQDMLSL Aurelien Jarno

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).