as everyone on #lisp knows, inline (signed-byte 64) arithmetic on x86
*nearly* works with my attached patch. However, it is not entirely
complete yet and in any case review by real SBCL hackers would be great.
The patch uses register pairing to implement storage classes
- Bug: Fails misc.220 with "no :MOVE-ARG VOP defined to move #<SB-C:TN A!1>
(SC SB-VM::DESCRIPTOR-REG) to #<SB-C:TN t2> (SC SB-VM::SIGNED64-REG)",
I am not entirely sure what :move-arg does anyway, so I am unsure
whether I need to write such a VOP or teach the compiler to not look
- Potential bug: Since storage class elements cannot have "holes", we
only define register pairs eax+edx, ecx+ebx, and esi+edi instead of
all possible pairs. This might be problem, because a VOP with
non-64-bit arguments or temporaries could end up without a free
register pair, although two non-adjacent registers would have been
free. Fixing this would involve changes to pack.lisp which I do not
plan on trying. In practise it does not seem to be a problem except in
:move-arg from signed64 to descriptor-reg, which has to cope with
lots of unavailable registers. See the comment in move-from-signed64
for the workaround.
- Question: Are the changes to primtype.lisp right? Look for "FIXME".
- Potential performance problem: On #lisp it was said that
representation selection might have trouble making the right
decisions. I have tried to select VOP costs slightly higher than
for the 32 bit case to make signed64 representation more costly. Did
I get that right? Real world performance according to cl-bench looks
unchanged, except for a significant speedup of CRC40.
- Todo list item: Some VOPs are too long (grep for KLUDGE) and should
perhaps be turned into assembly routines.
- Future work which could be commited later: Some more VOPs will
follow as I need them. Arrays specialized on (signed-byte 64)
would be nice to have.
- (unsigned-byte 64) arithmetic would be an obvious addition, but I do
not need it.
Thanks for any comments,
here is a new version of the contrib for inline (signed-byte 64)
arithmetic on x86. This version does not require any fishy renaming of
Attached the remaining patch to the compiler. The actual contrib is
From: David Lichteblau <dave-sbcl@li...> - 2005-04-10 20:31:49
> as everyone on #lisp knows, inline (signed-byte 64) arithmetic on x86
> *nearly* works with my attached patch. However, it is not entirely
> complete yet and in any case review by real SBCL hackers would be great.
... following Christophe's suggestion, I have turned most of this into a
contrib now. The result is at
The patch still reorders registers to put eax and ebx next to each
other, something that could perhaps be patched by the contrib at
runtime, too, if some uses of e[abcd]x-offset and similar at
read-time/macro-expansion time would be changed into run-time uses, but
I have not tried that yet.
Thanks again for any feedback,