01-03-2020, 11:38 PM
Maybe, since you use the cmpwi / beq- pattern a lot in the weight class checks, you could implement a loop w/ BL trick to shorten the code. What I mean is something like:
lightweight:
li r9, 0
bl check
.llong 0x01040506080C0D0E
middleweight:
li r9, 0x1
bl check
.llong 0x00070A0F10111214
check:
mflr rA
subi rA, rA, 0x1
li rC, 0x8
loop:
lbzu rB, 0x1 (rA)
cmpw r11, rB
beq- add_values
subic. rC, rC, 0x1
bne loop
cmpwi r9, 0x1
bne middleweight
li r9, 0x2
where rA, rB, rC are free registers. Just my two cents. Kinda cool you implemented region checks into the code itself.
lightweight:
li r9, 0
bl check
.llong 0x01040506080C0D0E
middleweight:
li r9, 0x1
bl check
.llong 0x00070A0F10111214
check:
mflr rA
subi rA, rA, 0x1
li rC, 0x8
loop:
lbzu rB, 0x1 (rA)
cmpw r11, rB
beq- add_values
subic. rC, rC, 0x1
bne loop
cmpwi r9, 0x1
bne middleweight
li r9, 0x2
where rA, rB, rC are free registers. Just my two cents. Kinda cool you implemented region checks into the code itself.