Implement the common idiom of using TEST REG, REG in place of CMP REG,
0, saving 1 byte, for fast-if->/< VOPs.
(:translate ,tran)
(:conditional ,(if signed cond unsigned))
(:generator ,cost
- (inst cmp x
- ,(case suffix
- (-c/fixnum
- `(constantize (fixnumize y)))
- ((-c/signed -c/unsigned)
- `(constantize y))
- (t 'y))))))
+ (cond ((and (sc-is x any-reg signed-reg unsigned-reg)
+ (eql y 0))
+ (inst test x x))
+ (t
+ (inst cmp x
+ ,(case suffix
+ (-c/fixnum
+ `(constantize (fixnumize y)))
+ ((-c/signed -c/unsigned)
+ `(constantize y))
+ (t 'y))))))))
'(/fixnum -c/fixnum /signed -c/signed /unsigned -c/unsigned)
; '(/fixnum /signed /unsigned)
'(4 3 6 5 6 5)
cond
unsigned))
(:generator ,cost
- (inst cmp x
- ,(if (eq suffix '-c/fixnum)
- '(fixnumize y)
- 'y)))))
+ (cond ((and (sc-is x any-reg signed-reg unsigned-reg)
+ (eql y 0))
+ (inst test x x))
+ (t
+ (inst cmp x
+ ,(if (eq suffix '-c/fixnum)
+ '(fixnumize y)
+ 'y)))))))
'(/fixnum -c/fixnum /signed -c/signed /unsigned -c/unsigned)
'(4 3 6 5 6 5)
'(t t t t nil nil)))))