;*************************************************************************
;** General Optimizer PC Absolute to Relative                           **
;** Contributor: Jess                 			Jan 30th  1998  **
;** Replace sub #0, add #0 by tst					**
;*************************************************************************



;*************************************************************************
;
; sub.b #$0,Dx -> tst.b dx
;
#match
#code
%1001XXX000111100   =# SourceReg	;SUB.B #$0,Dx
0000
;
;
#replace
%0100101000000XXX   =# SourceReg >> 9	;TST.B Dx
4DD6
#end

;*************************************************************************
;
; sub.w #$0,Dx -> tst.w dx
;
#match
#code
%1001XXX001111100   =# SourceReg	;SUB.W #$0,Dx
0000
;
;
#replace
%0100101001000XXX   =# SourceReg >> 9	;TST.W Dx
4DD6
#end

;*************************************************************************
;
; sub.l #$0,Dx -> tst.l dx
;
#match
#code
%1001XXX010111100   =# SourceReg	;SUB.L #$0,Dx
0000
0000
;
;
#replace
%0100101010000XXX   =# SourceReg >> 9	;TST.L Dx
4DD6
4DD6
#end


;*************************************************************************
;
; add.b #$0,Dx -> tst.b dx
;
#match
#code
%1101XXX000111100   =# SourceReg	;ADD.B #$0,Dx
0000
;
;
#replace
%0100101000000XXX   =# SourceReg >> 9	;TST.B Dx
4DD6
#end

;*************************************************************************
;
; add.w #$0,Dx -> tst.w dx
;
#match
#code
%1101XXX001111100   =# SourceReg	;ADD.W #$0,Dx
0000
;
;
#replace
%0100101001000XXX   =# SourceReg >> 9	;TST.W Dx
4DD6
#end

;*************************************************************************
;
; add.l #$0,Dx -> tst.l dx
;
#match
#code
%1101XXX010111100   =# SourceReg	;ADD.L #$0,Dx
0000
0000
;
;
#replace
%0100101010000XXX   =# SourceReg >> 9	;TST.L Dx
4DD6
4DD6
#end

;*************************************************************************
;
; cmp.b #$0,Dx -> tst.b dx
;
#match
#code
%1011XXX000111100   =# SourceReg	;CMP.B #$0,Dx
0000
;
;
#replace
%0100101000000XXX   =# SourceReg >> 9	;TST.B Dx
4DD6
#end

;*************************************************************************
;
; cmp.w #$0,Dx -> tst.w dx
;
#match
#code
%1011XXX001111100   =# SourceReg	;CMP.W #$0,Dx
0000
;
;
#replace
%0100101001000XXX   =# SourceReg >> 9	;TST.W Dx
4DD6
#end

;*************************************************************************
;
; cmp.l #$0,Dx -> tst.l dx
;
#match
#code
%1011XXX010111100   =# SourceReg	;CMP.L #$0,Dx
0000
0000
;
;
#replace
%0100101010000XXX   =# SourceReg >> 9	;TST.L Dx
4DD6
4DD6
#end

