step 1: sqr16_impl and imul16_impl take argument addresses
first step to removing function call overhead
This commit is contained in:
parent
f3a92708d2
commit
d93dd2e6a6
1 changed files with 26 additions and 23 deletions
|
|
@ -799,15 +799,15 @@ inner_loop:
|
|||
|
||||
.endproc
|
||||
|
||||
; min base mem: 81 * 4 + 22 * 2 + 10 + 6 = 384 cyc
|
||||
; max base mem: 92 * 4 + 27 * 2 + 50 + 6 = 478 cyc
|
||||
; min ext-mem: 50 * 4 + 22 * 2 + 10 + 6 = 260 cyc
|
||||
; max ext-mem: 55 * 4 + 27 * 2 + 50 + 6 = 330 cyc
|
||||
.macro imul16_impl xe
|
||||
; min base mem: 81 * 4 + 22 * 2 + 10 = 378 cyc
|
||||
; max base mem: 92 * 4 + 27 * 2 + 50 = 472 cyc
|
||||
; min ext-mem: 50 * 4 + 22 * 2 + 10 = 254 cyc
|
||||
; max ext-mem: 55 * 4 + 27 * 2 + 50 = 324 cyc
|
||||
.macro imul16_impl result, arg1, arg2, xe
|
||||
.scope
|
||||
arg1 = FR0 ; 16-bit arg
|
||||
arg2 = FR1 ; 16-bit arg
|
||||
result = FR2 ; 32-bit result (output)
|
||||
;arg1 ; 16-bit arg
|
||||
;arg2 ; 16-bit arg
|
||||
;result ; 32-bit result (output)
|
||||
inter = temp2 ; 16-bit temporary (clobbered)
|
||||
|
||||
; h1l1 * h2l2
|
||||
|
|
@ -843,8 +843,6 @@ inner_loop:
|
|||
bpl arg2_pos ; 2 cyc
|
||||
sub16 result + 2, result + 2, arg1 ; 20 cyc
|
||||
arg2_pos:
|
||||
|
||||
rts ; 6 cyc
|
||||
.endscope
|
||||
.endmacro
|
||||
|
||||
|
|
@ -877,15 +875,15 @@ inner_loop:
|
|||
.endmacro
|
||||
|
||||
|
||||
; min base ram: 5 + 163 + 6 = 174
|
||||
; max base ram: 7 + 184 + 18 + 6 = 215
|
||||
; min ext ram: 5 + 132 + 6 = 143
|
||||
; max ext ram: 7 + 147 + 18 + 6 = 178
|
||||
.macro sqr16_impl xe
|
||||
; min base ram: 5 + 163 + 3 = 171
|
||||
; max base ram: 7 + 184 + 18 = 209
|
||||
; min ext ram: 5 + 132 + 3 = 140
|
||||
; max ext ram: 7 + 147 + 18 = 172
|
||||
.macro sqr16_impl result, arg, xe
|
||||
.scope
|
||||
arg = FR0 ; 16-bit arg
|
||||
; arg ; 16-bit arg
|
||||
negated = FR1
|
||||
result = FR2 ; 32-bit result
|
||||
; result ; 32-bit result
|
||||
|
||||
; 5-7 cycles
|
||||
lda arg + 1 ; 3 cyc
|
||||
|
|
@ -894,29 +892,34 @@ inner_loop:
|
|||
|
||||
arg_pos:
|
||||
sqr16_impl_inner result, arg, xe ; 163-184 / 132-147 cyc
|
||||
rts ; 6 cyc
|
||||
jmp done ; 3 cyc
|
||||
|
||||
arg_neg:
|
||||
copy_neg16 negated, arg ; 18 cyc
|
||||
sqr16_impl_inner result, negated, xe ; 163-184 / 132-147 cyc
|
||||
rts ; 6 cyc
|
||||
|
||||
done:
|
||||
.endscope
|
||||
.endmacro
|
||||
|
||||
.proc imul16_func
|
||||
imul16_impl 0
|
||||
imul16_impl FR2, FR0, FR1, 0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc imul16xe_func
|
||||
imul16_impl 1
|
||||
imul16_impl FR2, FR0, FR1, 1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc sqr16_func
|
||||
sqr16_impl 0
|
||||
sqr16_impl FR2, FR0, 0
|
||||
rts
|
||||
.endproc
|
||||
|
||||
.proc sqr16xe_func
|
||||
sqr16_impl 1
|
||||
sqr16_impl FR2, FR0, 1
|
||||
rts
|
||||
.endproc
|
||||
|
||||
; 11-27 cycles
|
||||
|
|
|
|||
Loading…
Reference in a new issue