Remainder = divide, multiply back, subtract
PowerPC never got a remainder instruction. To compute one, the compiler stitches together three it does have, a divide followed by a multiply and then a subtract. With two variables p and q it looks like this:
divw r0, r3, r4 # quotient = p / q
mullw r0, r0, r4 # quotient * q
subf r3, r0, r3 # p - (quotient * q)
blr
Mind the operand order on subf. Despite how it reads, subf rD, rA, rB computes rD = rB - rA, the reverse of left-to-right. So subf r3, r0, r3 here works out to r3 - r0. That flipped ordering trips up nearly everyone new to PowerPC.
Once you can recognise the divide → mullw → subf trio, you know the source reached for %. Rename the variables however you like and the same three instructions come out.
Your task
Write mod2 for signed ints to reproduce the assembly above.