Free Look [JoshuaMK]
#4
Maybe your code could benefit from some simplification. I find that a code is a lot easier to debug when it’s optimized.

Recommendation 1: instead of having multiple branches, take the absolute value of your number you want to check and then just check if it’s greater/less than some bound, in one branch. Here’s the relevant function (parameter r3, return r6) from the PPC CWG:
srawi R4,R3,31
xor R5,R4,R3
subf R6,R4,R5

Recommendation 2: I noticed you have a lot of repeated code for the checks with different registers. There are two ways to fix this: either make your repeated code into a function or implement self-modifying ASM, in which you use the BL trick to get the address of the ASM address you want, then use rlwimi to change the register bits of the opcode. The catch with this is that you have to flush the instruction cache in order to fully “reset” your ASM; since it’s a little overkill so I would probably just use a function.
Reply


Messages In This Thread
Free Look [JoshuaMK] - by JoshuaMK - 09-21-2019, 10:09 PM
RE: Free Look [JoshuaMK] - by Vega - 09-22-2019, 01:48 PM
RE: Free Look [JoshuaMK] - by JoshuaMK - 09-22-2019, 06:40 PM
RE: Free Look [JoshuaMK] - by salmon01 - 09-22-2019, 11:39 PM
RE: Free Look [JoshuaMK] - by JoshuaMK - 09-23-2019, 12:50 AM
RE: Free Look [JoshuaMK] - by Vega - 10-09-2019, 10:47 PM
RE: Free Look [JoshuaMK] - by salmon01 - 10-09-2019, 11:51 PM
RE: Free Look [JoshuaMK] - by JoshuaMK - 10-10-2019, 03:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)