spin2cpp icon indicating copy to clipboard operation
spin2cpp copied to clipboard

multiply low/high fusing doesn't actually work on P2

Open Wuerfel21 opened this issue 2 years ago • 0 comments

... because the normal part of the multiply is emitted as a native op and the high part emits a function call.

As seen in some of the system functions:

__system___scas
	qmul	arg01, arg02
	getqx	_var01
	mov	muldiva_, arg01
	mov	muldivb_, arg02
	call	#multiply_
	shr	_var01, #30
	shl	muldivb_, #2
	or	muldivb_, _var01
	mov	result1, muldivb_
__system___scas_ret
	ret

Not sure how to fix this. Optimizing between function calls and cordic ops seems like it'd cause headaches and the high multiply is quite a lot of code, so just generating it inline is a bit eh. I guess these system functions in particular could be rewritten with inline ASM.

Wuerfel21 avatar Mar 09 '22 15:03 Wuerfel21