VR4300: Difference between revisions

1,178 bytes added ,  2 years ago
no edit summary
(Renamed references to the console's CPU to the term "VR4300" except when listing the full name of the IC chip.)
No edit summary
Line 2:
 
[[:File:VR4300-Users-Manual.pdf|VR4300 Users Manual]]
 
= 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 [https://en.wikipedia.org/wiki/Stepping_level steppings], and affects some but not all Nintendo 64 consoles. There is a ROM which tests if your hardware is affected by this bug (where?)
 
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</code> or <code>mul.d</code>. For example, consider this function:
 
float mul(float x, float y) { return x * y; }
 
If the fix is disabled, GCC will generate the following assembly (for the n32 ABI):
 
# Does not contain workaround, may cause problems.
mul:
jr $31
mul.s $f0,$f12,$f14
 
With the setting enabled, GCC will append <code>nop</code> instructions. Note that in this case, the second one goes into the branch delay slot.
 
# Contains workaround for CPU bug.
mul:
jr $31
nop
mul.s $f0,$f12,$f14
nop
 
[[Category:Motherboard components]]