integer-length for unsigned-byte 32 arg is slow
Describe the bug
Consider these functions:
(defun zot-u (n)
(declare (type (unsigned-byte 32) n)
(optimize (speed 3)))
(integer-length n))
(defun zot-s (n)
(declare (type (signed-byte 32) n)
(optimize (speed 3)))
(integer-length n))
To Reproduce
Steps to reproduce the behavior:
- Compile
zot-u
andzot-s
- Disassemble
zot-u
andzot-s
- See that the disassembly of
zot-s
uses the BSR instruction to compute the result ofinteger-length
- But note that
zot-u
doesn't and calls theinteger-length
function.
Expected behavior
zot-u
should be able to use the BSR
instruction to compute the
integer-length
of an (unsigned-byte 32)
number.
Desktop (please complete the following information):
- OS: Any x86
- Version: 21d and probably everything earlier
Additional context
We need to define a new vop to handle integer-length
when the arg is
an (unsigned-byte 32)
value.