Problem in a NEON instruction
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
target-arm/neon_helper.c +1 -1
@@ -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++; \
Quoted 9 lines · Laurent Desnogues
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
target-arm/neon_helper.c line 462
Quoted 8 lines
target-arm/neon_helper.c +1
-1@@ -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.
target-arm/neon_helper.c +2 -2
@@ -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 { \
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 13 lines · Aurelien Jarno
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.
target-arm/neon_helper.c +0
-0@@ -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 ) { \
target-arm/neon_helper.c uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop) · line 466
Quoted 10 lines
target-arm/neon_helper.c +2
-2- 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
Quoted 31 lines · Aurelien Jarno
Quoted 9 lines · Laurent Desnogues
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
target-arm/neon_helper.c 2008-06-10 12:27:38.000000000 +0200 line 462
Quoted 8 lines
target-arm/neon_helper.c 2008-06-10 12:27:38.000000000 +0200 renamed from target-arm/neon_helper.c 2008-06-09 08:52:48.000000000 +0200 +1
-1@@ -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.
target-arm/neon_helper.c +0
-0@@ -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 ) { \
target-arm/neon_helper.c uint64_t HELPER(neon_shl_s64)(uint64_t valop, uint64_t shiftop) · line 466
Quoted 10 lines
target-arm/neon_helper.c +2
-2- 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