From: Brett Gordon Date: Tue, 26 Jul 2016 14:19:58 +0000 (-0400) Subject: 6809: ashrsi3: 8 bit shift optimization X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9de414eefeeb8017d7b468ca1d2040d8814b5bd6;p=FUZIX.git 6809: ashrsi3: 8 bit shift optimization --- diff --git a/Kernel/lowlevel-6809.s b/Kernel/lowlevel-6809.s index a72b0bff..f3a73b8c 100644 --- a/Kernel/lowlevel-6809.s +++ b/Kernel/lowlevel-6809.s @@ -584,10 +584,22 @@ ___ashrsi3: ldu 6,s stu 2,x ldb 9,s - ;; FIXME: insert 16 and 8 optimization here - ;; remember to propigate top bit for signage + ;; FIXME: insert 16 optimization here + ;; remember to propagate top bit for signage +try_8@ cmpb #8 + blo try_rest@ + subb #8 + ldu 1,x ; shift what we can down by 1 byte + stu 2,x + lda ,x + sta 1,x + clr ,x ; default top byte to positive + tst 1,x ; test old msb for sign + bpl try_8@ ; go try another 8 shifts + dec ,x ; dec to make top byte negative + bra try_8@ ; go try another 8 shifts try_rest@ - tstb ; redunant until optimizations are added + tstb beq done@ do_rest@ ; Shift by 1