use TEST reg, reg to compare integer equality with zero
parent
588899a1b3
commit
4e4be60884
|
@ -432,8 +432,13 @@ M: x86 %epilogue ( n -- ) cell - incr-stack-reg ;
|
||||||
temp 0 MOV \ t rc-absolute-cell rel-immediate
|
temp 0 MOV \ t rc-absolute-cell rel-immediate
|
||||||
dst temp word execute ; inline
|
dst temp word execute ; inline
|
||||||
|
|
||||||
|
: (%compare) ( src1 src2 cc -- )
|
||||||
|
2over [ { cc= cc/= } member? ] [ register? ] [ 0 = ] tri* and and
|
||||||
|
[ drop dup TEST ]
|
||||||
|
[ CMP ] if ;
|
||||||
|
|
||||||
M:: x86 %compare ( dst src1 src2 cc temp -- )
|
M:: x86 %compare ( dst src1 src2 cc temp -- )
|
||||||
src1 src2 CMP
|
src1 src2 cc (%compare)
|
||||||
cc order-cc {
|
cc order-cc {
|
||||||
{ cc< [ dst temp \ CMOVL %boolean ] }
|
{ cc< [ dst temp \ CMOVL %boolean ] }
|
||||||
{ cc<= [ dst temp \ CMOVLE %boolean ] }
|
{ cc<= [ dst temp \ CMOVLE %boolean ] }
|
||||||
|
@ -447,7 +452,7 @@ M: x86 %compare-imm ( dst src1 src2 cc temp -- )
|
||||||
%compare ;
|
%compare ;
|
||||||
|
|
||||||
M:: x86 %compare-branch ( label src1 src2 cc -- )
|
M:: x86 %compare-branch ( label src1 src2 cc -- )
|
||||||
src1 src2 CMP
|
src1 src2 cc (%compare)
|
||||||
cc order-cc {
|
cc order-cc {
|
||||||
{ cc< [ label JL ] }
|
{ cc< [ label JL ] }
|
||||||
{ cc<= [ label JLE ] }
|
{ cc<= [ label JLE ] }
|
||||||
|
|
Loading…
Reference in New Issue