optimize(templates): use test ah or test al instead of test {{.AX}} in op_send

This commit is contained in:
vsariola 2021-03-27 16:03:47 +02:00
parent 9b4608e31e
commit 4c04f7a38c

View File

@ -91,7 +91,7 @@ su_op_aux_mono:
mov {{.CX}}, [{{.Stack "Voice"}}] ; load pointer to voice mov {{.CX}}, [{{.Stack "Voice"}}] ; load pointer to voice
{{- if .SupportsGlobalSend}} {{- if .SupportsGlobalSend}}
pushf ; uh ugly: we save the flags just for the stereo carry bit. Doing the .CX loading later crashed the synth for stereo sends as loading the synth address from stack was f'd up by the "call su_op_send_mono" pushf ; uh ugly: we save the flags just for the stereo carry bit. Doing the .CX loading later crashed the synth for stereo sends as loading the synth address from stack was f'd up by the "call su_op_send_mono"
test {{.AX}}, 0x8000 test ah, 0x80
jz su_op_send_skipglobal jz su_op_send_skipglobal
mov {{.CX}}, [{{.Stack "Synth"}} + {{.PTRSIZE}}] mov {{.CX}}, [{{.Stack "Synth"}} + {{.PTRSIZE}}]
su_op_send_skipglobal: su_op_send_skipglobal:
@ -106,12 +106,12 @@ su_op_send_skipglobal:
fxch ; r l fxch ; r l
call su_op_send_mono ; (r) l call su_op_send_mono ; (r) l
mov {{.AX}}, {{.DI}} ; move back to original address mov {{.AX}}, {{.DI}} ; move back to original address
test {{.AX}}, 0x8 ; if r was not popped and is still in the stack test al, 0x8 ; if r was not popped and is still in the stack
jnz su_op_send_mono jnz su_op_send_mono
fxch ; swap them back: l r fxch ; swap them back: l r
su_op_send_mono: su_op_send_mono:
{{- end}} {{- end}}
test {{.AX}}, 0x8 ; if the SEND_POP bit is not set test al, 0x8 ; if the SEND_POP bit is not set
jnz su_op_send_skippush jnz su_op_send_skippush
fld st0 ; duplicate the signal on stack: s s fld st0 ; duplicate the signal on stack: s s
su_op_send_skippush: ; there is signal s, but maybe also another: s (s) su_op_send_skippush: ; there is signal s, but maybe also another: s (s)