Call cmps rather than cmpu for bge... make cmps and cmpu rsts. Apply various

other tiny optimisations.
This commit is contained in:
David Given 2019-02-15 00:38:39 +01:00
parent 2924ce8ffa
commit 91c75f81b5
3 changed files with 89 additions and 65 deletions

View file

@ -11,6 +11,10 @@
! 41 call .floadn4 ! 41 call .floadn4
! 34 call .fload4 ! 34 call .fload4
! 28 call .fstoren2 ! 28 call .fstoren2
!
! Also:
! 48 call .cmps_mag
! 25 call .cmpu_mag
.define .rst_init .define .rst_init
.rst_init: .rst_init:
@ -18,13 +22,14 @@
lxi d, 0x0008 lxi d, 0x0008
call copy call copy
lxi h, .floadn4 lxi h, .floadn4
lxi d, 0x0010
call copy call copy
lxi h, .fload4 lxi h, .fload4
lxi d, 0x0018
call copy call copy
lxi h, .fstoren2 lxi h, .fstoren2
lxi d, 0x0020 call copy
lxi h, .cmps_mag
call copy
lxi h, .cmpu_mag
jmp copy jmp copy
! Copies eight bytes from HL to DE. ! Copies eight bytes from HL to DE.

View file

@ -1878,7 +1878,11 @@ pat blt
with hlreg dereg STACK with hlreg dereg STACK
uses areg uses areg
gen gen
#ifdef USE_I80_RSTS
rst {const1, 5}
#else
Call {label, ".cmps_mag"} Call {label, ".cmps_mag"}
#endif
jm {label, $1} jm {label, $1}
pat bgt pat bgt
@ -1890,7 +1894,11 @@ pat bge
with hlreg dereg STACK with hlreg dereg STACK
uses areg uses areg
gen gen
Call {label, ".cmpu_mag"} #ifdef USE_I80_RSTS
rst {const1, 5}
#else
Call {label, ".cmps_mag"}
#endif
jp {label, $1} jp {label, $1}
pat ble pat ble
@ -1949,61 +1957,67 @@ pat bne
jnz {label,$1} jnz {label,$1}
pat zlt pat zlt
with STACK with STACK
gen pop psw gen
pop psw
ora a ora a
jm {label,$1} jm {label,$1}
with hl_or_de STACK with regpair STACK
gen mov a,%1.1 gen
mov a,%1.1
ora a ora a
jm {label,$1} jm {label,$1}
pat zle pat zle
with hl_or_de STACK with regpair STACK
uses areg uses areg
gen xra a gen
add %1.1 mov a, %1.1
jm {label,$1} ora a
jnz {label,1f} jm {label, $1}
xra a jnz {label, 1f}
add %1.2 ora %1.2
jz {label,$1} jz {label, $1}
1: 1:
pat zeq pat zeq
with hl_or_de STACK with regpair STACK
uses areg uses areg
gen mov a,%1.1 gen
mov a,%1.1
ora %1.2 ora %1.2
jz {label,$1} jz {label,$1}
pat zne pat zne
with hl_or_de STACK with regpair STACK
uses areg uses areg
gen mov a,%1.1 gen
mov a,%1.1
ora %1.2 ora %1.2
jnz {label,$1} jnz {label,$1}
pat zge pat zge
with STACK with STACK
gen pop psw gen
pop psw
ral. ral.
jnc {label,$1} jnc {label,$1}
with hl_or_de STACK with regpair STACK
gen mov a,%1.1 gen
mov a,%1.1
ora a ora a
jp {label,$1} jp {label,$1}
pat zgt pat zgt
with hl_or_de STACK with regpair STACK
uses areg uses areg
gen xra a gen
add %1.1 mov a, %1.1
jm {label,1f} ora a
jnz {label,$1} jm {label, 1f}
xra a jnz {label, $1}
add %1.2 ora %1.2
jnz {label,$1} jnz {label, $1}
1: 1:
pat lol zeq pat lol zeq
@ -2027,18 +2041,20 @@ pat lol zne
jnz {label,$2} jnz {label,$2}
pat ior zeq $1==2 pat ior zeq $1==2
with hl_or_de hl_or_de STACK with regpair regpair STACK
uses areg uses areg
gen mov a,%1.1 gen
mov a,%1.1
ora %1.2 ora %1.2
ora %2.1 ora %2.1
ora %2.2 ora %2.2
jz {label,$2} jz {label,$2}
pat ior zne $1==2 pat ior zne $1==2
with hl_or_de hl_or_de STACK with regpair regpair STACK
uses areg uses areg
gen mov a,%1.1 gen
mov a,%1.1
ora %1.2 ora %1.2
ora %2.1 ora %2.1
ora %2.2 ora %2.2

View file

@ -16,4 +16,7 @@ xchg : inx d : xchg -> inx h ;
cpi 0 -> ora a ; cpi 0 -> ora a ;
call X : ret -> jmp X ; call X : ret -> jmp X ;
push h : lxi h, X : pop d -> lxi d, X : xchg ;
push d : lxi d, X : pop h -> lxi h, X : xchg ;
%%; %%;