Currently, comparing to zero uses __*cmpzero, and checking for only equality between integers uses __*cmpu or __*cmps. Slightly faster routines that only output to the Z flag could be used instead, so I am proposing adding __*equzero and __*cmpeq.
__*cmpzero : Z P
__*equzero : Z
__*cmpu : Z C
__*cmps : Z P V
__*cmpeq : Z
__*equzero and __*cmpeq can be emitted instead of __*cmpzero and __*cmp(u/s) when only the Z flag (or equality) is needed.
__*equzero can be aliased to __*cmpzero without issue.
__*cmpeq can be aliased to __*cmpu or __*cmps without issue.
For the most part, this is mainly a speed optimization. However, adding __llequzero and __i48equzero could be a beneficial size optimization, since the sign flag is basically never used from __llcmpzero and __i48cmpzero. So we could link just the smaller __llequzero and __i48equzero routines.
; 21 bytes
__llcmpzero:
inc b
dec b
ret nz
inc.s bc
dec c
jr nz, .p_nz
or a, a
sbc hl, bc
jr nz, .p_nz
sbc hl, de
ret z
add hl, de
.p_nz:
inc b
ld b, 0
ret
; 15 bytes
__llequzero:
inc b
dec b
ret nz
inc c
dec c
ret nz
add hl, bc
or a, a
sbc hl, bc
ret nz
sbc hl, de
add hl, de
ret
Currently, comparing to zero uses
__*cmpzero, and checking for only equality between integers uses__*cmpuor__*cmps. Slightly faster routines that only output to the Z flag could be used instead, so I am proposing adding__*equzeroand__*cmpeq.__*equzeroand__*cmpeqcan be emitted instead of__*cmpzeroand__*cmp(u/s)when only the Z flag (or equality) is needed.__*equzerocan be aliased to__*cmpzerowithout issue.__*cmpeqcan be aliased to__*cmpuor__*cmpswithout issue.For the most part, this is mainly a speed optimization. However, adding
__llequzeroand__i48equzerocould be a beneficial size optimization, since the sign flag is basically never used from__llcmpzeroand__i48cmpzero. So we could link just the smaller__llequzeroand__i48equzeroroutines.