Optimize for special cases

This commit is contained in:
Gabriel Tofvesson 2019-04-30 17:59:03 +02:00
parent d71a2bdb97
commit a2420be4c8

View File

@ -224,15 +224,16 @@ sub gr; incpc // Increment bucket length
mov pc pm; bls @IE_SPEC // Store new length mov pc pm; bls @IE_SPEC // Store new length
mov ar pc; sub ar mov ar pc; sub ar
sub ir sub ir // Save -IR into AR (you'll see why)
$INSERTION $INSERTION
mov pc asr; incpc; declc; bls @INSERTION_END_BIGGEST mov pc asr; incpc; declc; bls @INSERTION_END_BIGGEST
add pm add pm // Effectively, AR=PM-IR, except more like AR=-IR+PM
sub pm; brn @INSERTION sub pm; brn @INSERTION
mov pm ar mov pm ar
mov ir pm mov ir pm; bls @IEN_SPEC
$INSERTION_SHIFT $INSERTION_SHIFT
mov pc asr mov pc asr
@ -240,6 +241,10 @@ mov pm ir
mov ar pm; bls @INSERTION_END_NOTBIGGEST mov ar pm; bls @INSERTION_END_NOTBIGGEST
mov ir ar; declc; incpc; bra @INSERTION_SHIFT mov ir ar; declc; incpc; bra @INSERTION_SHIFT
$IEN_SPEC
mov pc asr
mov ar pm; bra @INSERTION_END_NOTBIGGEST
$IE_SPEC $IE_SPEC
mov ar asr mov ar asr