Likely a missing VOP (or bad cost info…). I'll look into it tomorrow
morning, after the SSE stuff.
> How would one go about writing a unit test that asserts that this
> doesn't happen?
> Martin suggests disassembling to a string stream and comparing literally
> the instruction sequence.
I believe that's what we currently do.
Fixed on x86 and x86-64 in 09f925d (Implement EQ of unboxed characters
and small integers on x86oids).
EQ presents the reverse situation of EQL: we try very hard in EQL to
detect when we can perform an EQ check... For EQ, we need to determine
when it makes sense to perform unboxed comparisons instead of the
fallback generic comparison. I believe it's most important for
characters and word-sized integers, with and without constants: these
are the cases that the compiler recognises. In fact, now that IR1
consistently downgrades EQL into EQ for EQ-comparable types, it might
make sense to remove some of the generic-EQL VOPs. In the meantime, the
commit simply marks a few EQL VOPs as also applicable for EQ.
* (disassemble '(lambda (x)
(declare (fixnum x) (optimize speed (safety 0)))
(zerop (logxor (ldb (byte 64 0) x) #xffffffff80aabbcc))))
; disassembly for (LAMBDA (X))
; Size: 31 bytes
; 039CFCC2: 4881F2CCBBAA80 XOR RDX, -2136294452 ;
no-arg-parsing entry point
; C9: 4885D2 TEST RDX, RDX ; This remaining test
still bothers me (:
; CC: BA17001020 MOV EDX, 537919511
; D1: 41BB4F001020 MOV R11D, 537919567
; D7: 490F44D3 CMOVEQ RDX, R11
; DB: 488BE5 MOV RSP, RBP
; DE: F8 CLC
; DF: 5D POP RBP
; E0: C3 RET