Douglas Katzman wrote:
> The AND can be removed, and the other unsigned constant can be treated as
> signed imm32 because it has 33 leftmost 1 bits. Improved code is
> below. In
> both functions, the entry code (not shown) converts RDX fixnum->signed
> "SAR RDX,1".
> ; 02A4CAB2: 4881F2CCBBAA80 XOR RDX, -2136294452 ;
> no-arg-parsing entry point
> ; B9: 4885D2 TEST RDX, RDX
> Patch is attached for review.
Good stuff; that's been annoying me for a while too.
The constraints on bitwidth date from before unboxed constants. It may
well be worth it to always handle constant operands directly, with
constantize to choose between 32 bit and RIP-relative operands, rather
than leaving some to be loaded via 64 bit moves. I think this is why I
handled truncate/c that way: IDIV with a RIP-relative operand is 7 bytes
(+ 8 for data, which might be reused), versus a 64 bit immediate move
(10 bytes) and a reg-reg IDIV (3 bytes). In the end, it's likely a wash…
Other VOPs can more easily save a register by avoiding 64 bit moves, and
that's a win.
I note that you changed the constraints on fixnum operands. The changes
have no effect: (signed-byte 32)-safe fixnum are exactly (signed-byte (-
> Also an unrelated patch to add a define-instruction for POPCNT.
I hope someone else can take care of that one (: