beardypig/ghidra-emotionengine

Strange right shift after multiplication

Closed this issue · 0 comments

I came across the following code snippet (well, there was a bit more but I've trimmed it down):

li v0, 0x350
mult v1, side, v0
jr ra
addu v0, v0, v1

Ghidra incorrectly gives (iParam1 * 0x350) >> 0x20 + 0x350, where the correct result would not have the right shift.

I was able to reproduce this with a small file just containing the above four instructions, which I've given here: a-minimal-example.zip.