VR4300: Difference between revisions

15 bytes removed ,  2 years ago
m
Fixed broken code formatting
m (→‎Known Bugs: Added a clearer example of the MUL/MUL CPU bug)
m (Fixed broken code formatting)
Line 10:
 
For example, consider this function:
<code>float mul(float x, float y) { return x * y; }</code>
 
<code>float mul(float x, float y) { return x * y; }</code>
Without the fix it may generate this code:
<codepre>
jal mul
nop
Line 20 ⟶ 19:
jr $31
mul.s $f0,$f12,$f14
</codepre>
The mul.s after the nop (red) may produce unexpected results, if the operands in the mul.s after the jr (yellow) include NaN, Zero or Infinity.
 
With the fix it may generate this code:
<codepre>
mul.s $f1,$f13,$f15
nop
Line 34 ⟶ 33:
jr $31
nop
</codepre>
Depending on the other instructions that can be reordered the nops could be other instructions that perform work, so this is a worst case scenario.
There may be a ROM which tests if your hardware is affected by this bug, but determining based on the Motherboard revision is easier.
[[Category:Motherboard components]]