qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms
@ 2011-01-08 16:01 Peter Maydell
  2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 1/2] ARM: add neon helpers for VQSHLU Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2011-01-08 16:01 UTC (permalink / raw)
  To: qemu-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

This patchset fixes errors in the decoding and implementation of the
immediate forms of the VQSHL/VQSHLU ARM instructions.
Tested in the usual random-instruction-set way. This is the final part
of the maemo-qemu tree commit 03a2445a fixes (the first part being
the already-committed VQSHL-reg patchset); the patch down as authored
by me is a minor tweaking of changes in the maemo-qemu commit.

There are no code changes here since v1, I've just got the author
attributions right (and added the reviewed-by tags from Aurelien,
thanks!)

Juha Riihimäki (1):
  ARM: add neon helpers for VQSHLU

Peter Maydell (1):
  ARM: Fix decoding of VQSHL/VQSHLU immediate forms

 target-arm/helpers.h     |    4 +++
 target-arm/neon_helper.c |   47 ++++++++++++++++++++++++++++++++++++++++++
 target-arm/translate.c   |   51 ++++++++++++++++++++++++++++++++-------------
 3 files changed, 87 insertions(+), 15 deletions(-)

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

* [Qemu-devel] [PATCH v2 1/2] ARM: add neon helpers for VQSHLU
  2011-01-08 16:01 [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms Peter Maydell
@ 2011-01-08 16:01 ` Peter Maydell
  2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 2/2] ARM: Fix decoding of VQSHL/VQSHLU immediate forms Peter Maydell
  2011-01-11 23:12 ` [Qemu-devel] [PATCH v2 0/2] ARM: Fix " Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-01-08 16:01 UTC (permalink / raw)
  To: qemu-devel

From: Juha Riihimäki <juha.riihimaki@nokia.com>

Add neon helper functions to implement VQSHLU, which is a
signed-to-unsigned version of VQSHL available only as an
immediate form.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/helpers.h     |    4 +++
 target-arm/neon_helper.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/target-arm/helpers.h b/target-arm/helpers.h
index 0d1bc47..b88ebae 100644
--- a/target-arm/helpers.h
+++ b/target-arm/helpers.h
@@ -249,6 +249,10 @@ DEF_HELPER_3(neon_qshl_u32, i32, env, i32, i32)
 DEF_HELPER_3(neon_qshl_s32, i32, env, i32, i32)
 DEF_HELPER_3(neon_qshl_u64, i64, env, i64, i64)
 DEF_HELPER_3(neon_qshl_s64, i64, env, i64, i64)
+DEF_HELPER_3(neon_qshlu_s8, i32, env, i32, i32);
+DEF_HELPER_3(neon_qshlu_s16, i32, env, i32, i32);
+DEF_HELPER_3(neon_qshlu_s32, i32, env, i32, i32);
+DEF_HELPER_3(neon_qshlu_s64, i64, env, i64, i64);
 DEF_HELPER_3(neon_qrshl_u8, i32, env, i32, i32)
 DEF_HELPER_3(neon_qrshl_s8, i32, env, i32, i32)
 DEF_HELPER_3(neon_qrshl_u16, i32, env, i32, i32)
diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index dae063e..20f3c16 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -632,6 +632,53 @@ uint64_t HELPER(neon_qshl_s64)(CPUState *env, uint64_t valop, uint64_t shiftop)
     return val;
 }
 
+#define NEON_FN(dest, src1, src2) do { \
+    if (src1 & (1 << (sizeof(src1) * 8 - 1))) { \
+        SET_QC(); \
+        dest = 0; \
+    } else { \
+        int8_t tmp; \
+        tmp = (int8_t)src2; \
+        if (tmp >= (ssize_t)sizeof(src1) * 8) { \
+            if (src1) { \
+                SET_QC(); \
+                dest = ~0; \
+            } else { \
+                dest = 0; \
+            } \
+        } else if (tmp <= -(ssize_t)sizeof(src1) * 8) { \
+            dest = 0; \
+        } else if (tmp < 0) { \
+            dest = src1 >> -tmp; \
+        } else { \
+            dest = src1 << tmp; \
+            if ((dest >> tmp) != src1) { \
+                SET_QC(); \
+                dest = ~0; \
+            } \
+        } \
+    }} while (0)
+NEON_VOP_ENV(qshlu_s8, neon_u8, 4)
+NEON_VOP_ENV(qshlu_s16, neon_u16, 2)
+#undef NEON_FN
+
+uint32_t HELPER(neon_qshlu_s32)(CPUState *env, uint32_t valop, uint32_t shiftop)
+{
+    if ((int32_t)valop < 0) {
+        SET_QC();
+        return 0;
+    }
+    return helper_neon_qshl_u32(env, valop, shiftop);
+}
+
+uint64_t HELPER(neon_qshlu_s64)(CPUState *env, uint64_t valop, uint64_t shiftop)
+{
+    if ((int64_t)valop < 0) {
+        SET_QC();
+        return 0;
+    }
+    return helper_neon_qshl_u64(env, valop, shiftop);
+}
 
 /* FIXME: This is wrong.  */
 #define NEON_FN(dest, src1, src2) do { \
-- 
1.6.3.3

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

* [Qemu-devel] [PATCH v2 2/2] ARM: Fix decoding of VQSHL/VQSHLU immediate forms
  2011-01-08 16:01 [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms Peter Maydell
  2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 1/2] ARM: add neon helpers for VQSHLU Peter Maydell
@ 2011-01-08 16:01 ` Peter Maydell
  2011-01-11 23:12 ` [Qemu-devel] [PATCH v2 0/2] ARM: Fix " Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-01-08 16:01 UTC (permalink / raw)
  To: qemu-devel

Fix errors in the decoding of ARM VQSHL/VQSHLU immediate forms,
including using the new VQSHLU helper functions where appropriate.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/translate.c |   51 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 2ce82f3..57664bc 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -4652,14 +4652,22 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                         case 5: /* VSHL, VSLI */
                             gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
                             break;
-                        case 6: /* VQSHL */
-                            if (u)
-                                gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1);
-                            else
-                                gen_helper_neon_qshl_s64(cpu_V0, cpu_env, cpu_V0, cpu_V1);
+                        case 6: /* VQSHLU */
+                            if (u) {
+                                gen_helper_neon_qshlu_s64(cpu_V0, cpu_env,
+                                                          cpu_V0, cpu_V1);
+                            } else {
+                                return 1;
+                            }
                             break;
-                        case 7: /* VQSHLU */
-                            gen_helper_neon_qshl_u64(cpu_V0, cpu_env, cpu_V0, cpu_V1);
+                        case 7: /* VQSHL */
+                            if (u) {
+                                gen_helper_neon_qshl_u64(cpu_V0, cpu_env,
+                                                         cpu_V0, cpu_V1);
+                            } else {
+                                gen_helper_neon_qshl_s64(cpu_V0, cpu_env,
+                                                         cpu_V0, cpu_V1);
+                            }
                             break;
                         }
                         if (op == 1 || op == 3) {
@@ -4698,17 +4706,30 @@ static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
                             default: return 1;
                             }
                             break;
-                        case 6: /* VQSHL */
-                            GEN_NEON_INTEGER_OP_ENV(qshl);
-                            break;
-                        case 7: /* VQSHLU */
+                        case 6: /* VQSHLU */
+                            if (!u) {
+                                return 1;
+                            }
                             switch (size) {
-                            case 0: gen_helper_neon_qshl_u8(tmp, cpu_env, tmp, tmp2); break;
-                            case 1: gen_helper_neon_qshl_u16(tmp, cpu_env, tmp, tmp2); break;
-                            case 2: gen_helper_neon_qshl_u32(tmp, cpu_env, tmp, tmp2); break;
-                            default: return 1;
+                            case 0:
+                                gen_helper_neon_qshlu_s8(tmp, cpu_env,
+                                                         tmp, tmp2);
+                                break;
+                            case 1:
+                                gen_helper_neon_qshlu_s16(tmp, cpu_env,
+                                                          tmp, tmp2);
+                                break;
+                            case 2:
+                                gen_helper_neon_qshlu_s32(tmp, cpu_env,
+                                                          tmp, tmp2);
+                                break;
+                            default:
+                                return 1;
                             }
                             break;
+                        case 7: /* VQSHL */
+                            GEN_NEON_INTEGER_OP_ENV(qshl);
+                            break;
                         }
                         dead_tmp(tmp2);
 
-- 
1.6.3.3

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

* Re: [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms
  2011-01-08 16:01 [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms Peter Maydell
  2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 1/2] ARM: add neon helpers for VQSHLU Peter Maydell
  2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 2/2] ARM: Fix decoding of VQSHL/VQSHLU immediate forms Peter Maydell
@ 2011-01-11 23:12 ` Aurelien Jarno
  2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-01-11 23:12 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Sat, Jan 08, 2011 at 04:01:14PM +0000, Peter Maydell wrote:
> This patchset fixes errors in the decoding and implementation of the
> immediate forms of the VQSHL/VQSHLU ARM instructions.
> Tested in the usual random-instruction-set way. This is the final part
> of the maemo-qemu tree commit 03a2445a fixes (the first part being
> the already-committed VQSHL-reg patchset); the patch down as authored
> by me is a minor tweaking of changes in the maemo-qemu commit.
> 
> There are no code changes here since v1, I've just got the author
> attributions right (and added the reviewed-by tags from Aurelien,
> thanks!)
> 
> Juha Riihimäki (1):
>   ARM: add neon helpers for VQSHLU
> 
> Peter Maydell (1):
>   ARM: Fix decoding of VQSHL/VQSHLU immediate forms
> 
>  target-arm/helpers.h     |    4 +++
>  target-arm/neon_helper.c |   47 ++++++++++++++++++++++++++++++++++++++++++
>  target-arm/translate.c   |   51 ++++++++++++++++++++++++++++++++-------------
>  3 files changed, 87 insertions(+), 15 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-01-11 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 16:01 [Qemu-devel] [PATCH v2 0/2] ARM: Fix VQSHL/VQSHLU immediate forms Peter Maydell
2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 1/2] ARM: add neon helpers for VQSHLU Peter Maydell
2011-01-08 16:01 ` [Qemu-devel] [PATCH v2 2/2] ARM: Fix decoding of VQSHL/VQSHLU immediate forms Peter Maydell
2011-01-11 23:12 ` [Qemu-devel] [PATCH v2 0/2] ARM: Fix " 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).