beardypig / ghidra-emotionengine

Ghidra Processor for the Play Station 2's Emotion Engine MIPS based CPU
Apache License 2.0
200 stars 34 forks source link

Simplified interpretation of cvt.w.S #57

Closed mdecicco closed 3 years ago

mdecicco commented 3 years ago

Conversion from float to int was cluttering up the decompilation with explicit conversion logic instead of just using dest = (int)source

beardypig commented 3 years ago

@Tupelov seems like you looked at this too, would you mind commenting on this change?

astrelsky commented 3 years ago

I think this is correct. I'd like to double check with someone who is more familiar with the ps2 to know for certain if it is always truncated. I think there are options to change this behavior but I don't remember.

@uyjulian do you know about this by any chance?

uyjulian commented 3 years ago

Hmm… not sure.

The PS2 is not entirely IEEE754 compilant, but since this would make the decompilation similar to the behavior of -mhard-float, I think this would be fine.

uyjulian commented 3 years ago

This is what the EE instruction set manual says… image

beardypig commented 3 years ago

After sleeping on it, I have decided that the change should be included. It wouldn't negatively affect the disassembly view but it would improve the decompilation. The current decompilation is a mess and stands no chance of being compiled back to the instruction that it came from, but a cast with the right complication flags should.

VelocityRa commented 3 years ago

What's the holdup with this PR?