VR4300: Difference between revisions
m
→Known Bugs: Added a clearer example of the MUL/MUL CPU bug
mNo edit summary |
Fraser.mips (talk | contribs) m (→Known Bugs: Added a clearer example of the MUL/MUL CPU bug) |
||
Line 5:
= Known Bugs =
Some VR4300 CPUs contain the “VR4300 multiplication bug”. This causes incorrect results to be generated, under certain circumstances, after computing a floating-point multiplication. The bug was fixed in later processor [https://en.wikipedia.org/wiki/Stepping_level steppings], and affects
GCC accepts the <code>-mfix4300</code> flag, which tells GCC to generate code with a workaround for this bug—two <code>nop</code> instructions are inserted after every <code>mul.s (fp),</code>
For example, consider this function:
float mul(float x, float y) { return x * y; }▼
Without the fix it may generate this code:
<code>
</code>
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.
▲ mul:
▲ mul.s $f0,$f12,$f14
nop▼
▲ jr $31
nop▼
With the fix it may generate this code:
<code>
mul.s $f1,$f13,$f15
jal mul
nop
mul:
mul.s $f0,$f12,$f14
jr $31
nop
</code>
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]]
|