qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [ARM] Problem in a NEON instruction
@ 2008-06-10 10:32 Laurent Desnogues
  2008-10-14  9:23 ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Desnogues @ 2008-06-10 10:32 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

The rshl instruction is faulty.  Note I did not check the correctness
of that instruction in general, I only made a change that looked logical.


Laurent

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arm-neon.patch --]
[-- Type: text/x-patch; name=arm-neon.patch, Size: 460 bytes --]

--- svn-ref/target-arm/neon_helper.c	2008-06-09 08:52:48.000000000 +0200
+++ svn/target-arm/neon_helper.c	2008-06-10 12:27:38.000000000 +0200
@@ -456,7 +456,7 @@
     if (tmp >= sizeof(src1) * 8) { \
         dest = 0; \
     } else if (tmp < -sizeof(src1) * 8) { \
-        dest >>= sizeof(src1) * 8 - 1; \
+        dest = src1 >> (sizeof(src1) * 8 - 1); \
     } else if (tmp == -sizeof(src1) * 8) { \
         dest = src1 >> (tmp - 1); \
         dest++; \

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

* Re: [Qemu-devel] [ARM] Problem in a NEON instruction
  2008-06-10 10:32 [Qemu-devel] [ARM] Problem in a NEON instruction Laurent Desnogues
@ 2008-10-14  9:23 ` Aurelien Jarno
  2008-10-14  9:52   ` Laurent Desnogues
  2008-12-09 19:21   ` Laurent Desnogues
  0 siblings, 2 replies; 4+ messages in thread
From: Aurelien Jarno @ 2008-10-14  9:23 UTC (permalink / raw)
  To: qemu-devel

On Tue, Jun 10, 2008 at 12:32:17PM +0200, Laurent Desnogues wrote:
> The rshl instruction is faulty.  Note I did not check the correctness
> of that instruction in general, I only made a change that looked logical.
> 
> 
> Laurent

> --- svn-ref/target-arm/neon_helper.c	2008-06-09 08:52:48.000000000 +0200
> +++ svn/target-arm/neon_helper.c	2008-06-10 12:27:38.000000000 +0200
> @@ -456,7 +456,7 @@
>      if (tmp >= sizeof(src1) * 8) { \
>          dest = 0; \
>      } else if (tmp < -sizeof(src1) * 8) { \
> -        dest >>= sizeof(src1) * 8 - 1; \
> +        dest = src1 >> (sizeof(src1) * 8 - 1); \
>      } else if (tmp == -sizeof(src1) * 8) { \
>          dest = src1 >> (tmp - 1); \
>          dest++; \

Your patch is indeed correct. It seems there is another mistake (at
least compared to the 64-bit version) in this instruction, please find
an updated patch below.

diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
index 4ee5658..35fbaf5 100644
--- a/target-arm/neon_helper.c
+++ b/target-arm/neon_helper.c
@@ -456,11 +456,11 @@ uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop)
     if (tmp >= sizeof(src1) * 8) { \
         dest = 0; \
     } else if (tmp < -sizeof(src1) * 8) { \
-        dest >>= sizeof(src1) * 8 - 1; \
+        dest = src1 >> (sizeof(src1) * 8 - 1); \
     } else if (tmp == -sizeof(src1) * 8) { \
         dest = src1 >> (tmp - 1); \
         dest++; \
-        src2 >>= 1; \
+        dest >>= 1; \
     } else if (tmp < 0) { \
         dest = (src1 + (1 << (-1 - tmp))) >> -tmp; \
     } else { \


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

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

* Re: [Qemu-devel] [ARM] Problem in a NEON instruction
  2008-10-14  9:23 ` Aurelien Jarno
@ 2008-10-14  9:52   ` Laurent Desnogues
  2008-12-09 19:21   ` Laurent Desnogues
  1 sibling, 0 replies; 4+ messages in thread
From: Laurent Desnogues @ 2008-10-14  9:52 UTC (permalink / raw)
  To: qemu-devel

On Tue, Oct 14, 2008 at 11:23 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
>
> Your patch is indeed correct. It seems there is another mistake (at
> least compared to the 64-bit version) in this instruction, please find
> an updated patch below.
>
> diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
> index 4ee5658..35fbaf5 100644
> --- a/target-arm/neon_helper.c
> +++ b/target-arm/neon_helper.c
> @@ -456,11 +456,11 @@ uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop)
>     if (tmp >= sizeof(src1) * 8) { \
>         dest = 0; \
>     } else if (tmp < -sizeof(src1) * 8) { \
> -        dest >>= sizeof(src1) * 8 - 1; \
> +        dest = src1 >> (sizeof(src1) * 8 - 1); \
>     } else if (tmp == -sizeof(src1) * 8) { \
>         dest = src1 >> (tmp - 1); \
>         dest++; \
> -        src2 >>= 1; \
> +        dest >>= 1; \
>     } else if (tmp < 0) { \
>         dest = (src1 + (1 << (-1 - tmp))) >> -tmp; \
>     } else { \

Your addition looks good to me.


Laurent

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

* Re: [Qemu-devel] [ARM] Problem in a NEON instruction
  2008-10-14  9:23 ` Aurelien Jarno
  2008-10-14  9:52   ` Laurent Desnogues
@ 2008-12-09 19:21   ` Laurent Desnogues
  1 sibling, 0 replies; 4+ messages in thread
From: Laurent Desnogues @ 2008-12-09 19:21 UTC (permalink / raw)
  To: qemu-devel

On Tue, Oct 14, 2008 at 10:23 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> On Tue, Jun 10, 2008 at 12:32:17PM +0200, Laurent Desnogues wrote:
>> The rshl instruction is faulty.  Note I did not check the correctness
>> of that instruction in general, I only made a change that looked logical.
>>
>>
>> Laurent
>
>> --- svn-ref/target-arm/neon_helper.c  2008-06-09 08:52:48.000000000 +0200
>> +++ svn/target-arm/neon_helper.c      2008-06-10 12:27:38.000000000 +0200
>> @@ -456,7 +456,7 @@
>>      if (tmp >= sizeof(src1) * 8) { \
>>          dest = 0; \
>>      } else if (tmp < -sizeof(src1) * 8) { \
>> -        dest >>= sizeof(src1) * 8 - 1; \
>> +        dest = src1 >> (sizeof(src1) * 8 - 1); \
>>      } else if (tmp == -sizeof(src1) * 8) { \
>>          dest = src1 >> (tmp - 1); \
>>          dest++; \
>
> Your patch is indeed correct. It seems there is another mistake (at
> least compared to the 64-bit version) in this instruction, please find
> an updated patch below.
>
> diff --git a/target-arm/neon_helper.c b/target-arm/neon_helper.c
> index 4ee5658..35fbaf5 100644
> --- a/target-arm/neon_helper.c
> +++ b/target-arm/neon_helper.c
> @@ -456,11 +456,11 @@ uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop)
>     if (tmp >= sizeof(src1) * 8) { \
>         dest = 0; \
>     } else if (tmp < -sizeof(src1) * 8) { \
> -        dest >>= sizeof(src1) * 8 - 1; \
> +        dest = src1 >> (sizeof(src1) * 8 - 1); \
>     } else if (tmp == -sizeof(src1) * 8) { \
>         dest = src1 >> (tmp - 1); \
>         dest++; \
> -        src2 >>= 1; \
> +        dest >>= 1; \
>     } else if (tmp < 0) { \
>         dest = (src1 + (1 << (-1 - tmp))) >> -tmp; \
>     } else { \

Can someone consider that patch especially now that gcc 4
displays some well deserved warnings about the code :-)


Laurent

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

end of thread, other threads:[~2008-12-09 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 10:32 [Qemu-devel] [ARM] Problem in a NEON instruction Laurent Desnogues
2008-10-14  9:23 ` Aurelien Jarno
2008-10-14  9:52   ` Laurent Desnogues
2008-12-09 19:21   ` Laurent Desnogues

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