Skip to content

Commit

Permalink
cpu.architecture: remove un-needed temp register in %bit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Aug 22, 2023
1 parent e851bf5 commit 18b341d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions basis/compiler/cfg/instructions/instructions.factor
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ use: src/int-rep ;

FOLDABLE-INSN: ##bit-test
def: dst/tagged-rep
use: src1/int-rep src2/int-rep
temp: temp/int-rep ;
use: src1/int-rep src2/int-rep ;

! Float arithmetic
FOLDABLE-INSN: ##add-float
Expand Down
2 changes: 1 addition & 1 deletion basis/cpu/architecture/architecture.factor
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ HOOK: %not cpu ( dst src -- )
HOOK: %neg cpu ( dst src -- )
HOOK: %log2 cpu ( dst src -- )
HOOK: %bit-count cpu ( dst src -- )
HOOK: %bit-test cpu ( dst src1 src2 temp -- )
HOOK: %bit-test cpu ( dst src1 src2 -- )

HOOK: %copy cpu ( dst src rep -- )

Expand Down
2 changes: 1 addition & 1 deletion basis/cpu/arm/64/64.factor
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ M: arm.64 %bit-count
D0 swap DX FMOVgen ;

M: arm.64 %bit-test
[ 2^ swap TSTi ] dip
[ 2^ swap TSTi ] keep
swap dup EQ CSEL ;

M: arm.64 %and rot ANDr ;
Expand Down
4 changes: 2 additions & 2 deletions basis/cpu/x86/x86.factor
Original file line number Diff line number Diff line change
Expand Up @@ -771,9 +771,9 @@ M: x86 immediate-bitwise?
{ cc/<>= [ src1 src2 compare call( a b -- ) label JP ] }
} case ;

M:: x86 %bit-test ( dst src1 src2 temp -- )
M:: x86 %bit-test ( dst src1 src2 -- )
src1 src2 BT
dst temp \ CMOVB (%boolean) ;
dst src2 \ CMOVB (%boolean) ;

M: x86 enable-cpu-features
enable-min/max
Expand Down

0 comments on commit 18b341d

Please sign in to comment.