* [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores
@ 2011-04-18 18:07 Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores Peter Maydell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2011-04-18 18:07 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
These two simple patches make qemu correctly UNDEF where required in the
Neon load/store space. We also catch and UNDEF on an UNPREDICTABLE rather
than indexing off the end of the register file.
Tested in the usual way with random instruction sequences.
Peter Maydell (2):
target-arm: Handle UNDEFs for Neon single element load/stores
target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures
target-arm/translate.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores
2011-04-18 18:07 [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Peter Maydell
@ 2011-04-18 18:07 ` Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 2/2] target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures Peter Maydell
2011-04-25 20:13 ` [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-04-18 18:07 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
Handle the UNDEF and UNPREDICTABLE cases for Neon "single element to
one lane" VLD and "single element from one lane" VST.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/translate.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 6190028..5820add 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -3975,6 +3975,7 @@ static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn)
stride = (1 << size) * nregs;
} else {
/* Single element. */
+ int idx = (insn >> 4) & 0xf;
pass = (insn >> 7) & 1;
switch (size) {
case 0:
@@ -3993,6 +3994,39 @@ static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn)
abort();
}
nregs = ((insn >> 8) & 3) + 1;
+ /* Catch the UNDEF cases. This is unavoidably a bit messy. */
+ switch (nregs) {
+ case 1:
+ if (((idx & (1 << size)) != 0) ||
+ (size == 2 && ((idx & 3) == 1 || (idx & 3) == 2))) {
+ return 1;
+ }
+ break;
+ case 3:
+ if ((idx & 1) != 0) {
+ return 1;
+ }
+ /* fall through */
+ case 2:
+ if (size == 2 && (idx & 2) != 0) {
+ return 1;
+ }
+ break;
+ case 4:
+ if ((size == 2) && ((idx & 3) == 3)) {
+ return 1;
+ }
+ break;
+ default:
+ abort();
+ }
+ if ((rd + stride * (nregs - 1)) > 31) {
+ /* Attempts to write off the end of the register file
+ * are UNPREDICTABLE; we choose to UNDEF because otherwise
+ * the neon_load_reg() would write off the end of the array.
+ */
+ return 1;
+ }
addr = tcg_temp_new_i32();
load_reg_var(s, addr, rn);
for (reg = 0; reg < nregs; reg++) {
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH 2/2] target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures
2011-04-18 18:07 [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores Peter Maydell
@ 2011-04-18 18:07 ` Peter Maydell
2011-04-25 20:13 ` [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-04-18 18:07 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
Correctly UNDEF for Neon VLD/VST "multiple structures" forms where the
align field is not valid.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/translate.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 5820add..30ca7df 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -3830,6 +3830,21 @@ static int disas_neon_ls_insn(CPUState * env, DisasContext *s, uint32_t insn)
size = (insn >> 6) & 3;
if (op > 10)
return 1;
+ /* Catch UNDEF cases for bad values of align field */
+ switch (op & 0xc) {
+ case 4:
+ if (((insn >> 5) & 1) == 1) {
+ return 1;
+ }
+ break;
+ case 8:
+ if (((insn >> 4) & 3) == 3) {
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
nregs = neon_ls_element_type[op].nregs;
interleave = neon_ls_element_type[op].interleave;
spacing = neon_ls_element_type[op].spacing;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores
2011-04-18 18:07 [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 2/2] target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures Peter Maydell
@ 2011-04-25 20:13 ` Aurelien Jarno
2 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-04-25 20:13 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Mon, Apr 18, 2011 at 07:07:10PM +0100, Peter Maydell wrote:
> These two simple patches make qemu correctly UNDEF where required in the
> Neon load/store space. We also catch and UNDEF on an UNPREDICTABLE rather
> than indexing off the end of the register file.
>
> Tested in the usual way with random instruction sequences.
>
> Peter Maydell (2):
> target-arm: Handle UNDEFs for Neon single element load/stores
> target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures
>
> target-arm/translate.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 49 insertions(+), 0 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-04-25 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 18:07 [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 1/2] target-arm: Handle UNDEFs for Neon single element load/stores Peter Maydell
2011-04-18 18:07 ` [Qemu-devel] [PATCH 2/2] target-arm: Handle UNDEF cases for Neon VLD/VST multiple-structures Peter Maydell
2011-04-25 20:13 ` [Qemu-devel] [PATCH 0/2] target-arm: Handle UNDEF cases for Neon load/stores 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).