lshift.asm bug
delta trinity
deltatrinity at hotmail.com
Wed Mar 7 13:39:45 CET 2007
Hello
I was looking at the asm source code for the k7 (gmp 4.2.1) mmx lshift.asm,
and found a bug
In the unroll section, there are 2 lines (lines 271 and 272):
leal ifelse(UNROLL_BYTES,256,128) -8(%edx,%eax,2), %edx
leal ifelse(UNROLL_BYTES,256,128) (%edi,%eax,2), %edi
and further down, in the unroll loop (line 313)
deflit(`disp0', eval(-i*CHUNK_COUNT*4 ifelse(UNROLL_BYTES,256,-128)))
which should have been
leal ifelse(UNROLL_BYTES,256,-128+8) -8(%edx,%eax,2), %edx
leal ifelse(UNROLL_BYTES,256,-128+8) (%edi,%eax,2), %edi
(note the -120 instead of +128)
and further down, in the unroll loop (line 313)
deflit(`disp0', eval(-i*CHUNK_COUNT*4 ifelse(UNROLL_BYTES,256,+128-8)))
(note the +120 instead of -128)
it look like the code have simply been copy&pasted from rshift.asm (which is
correct for rshift.asm).
>From the code as it is now, if the unrolled loop span 256 bytes of data
(UNROLL_COUNT=64), this will compile a mix of 1 and 4-bytes offset 'movl' in
the unrolled loop. This is bad and will create program fault when run.
With the corrected code, this will compile all 1-byte offset 'movl'.
It is to note that the default (shipped with GMP 4.2.1) is UNROLL_COUNT=32,
so this bug is not seen under default conditions.
Regards
Eric
_________________________________________________________________
Find a local pizza place, movie theater, and more
.then map the best route!
http://maps.live.com/?icid=hmtag1&FORM=MGAC01
More information about the gmp-bugs
mailing list