COP1: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
Line 241: Line 241:


== Full Mode vs Half Mode ==
== Full Mode vs Half Mode ==
The COP1 can run in one of two modes, which is controlled via COP0.Status Bit 26. In "Full Mode", 32 bit registers that are each 64 bits wide are available. In "Half Mode", only the 16 even registers are supposed to be used; using even numbered registers is considered undefined behavior.
The COP1 can run in one of two modes, which is controlled via COP0.Status Bit 26. In "Full Mode", the COP1 has 32 bit registers that are each 64 bits wide are available. In "Half Mode", only the 16 even registers are legal to be used; using odd numbered registers is considered undefined behavior.


Older software usually ran in "Half Mode". A reason for that could be that context switches (for multiple threads) can be performed more cheaply, as only 16 FPU registers need to be stored.
Older software usually ran in "Half Mode". A reason for that could be that context switches (for multithreading) can be performed more cheaply, as only 16 FPU registers need to be stored.


When using "Half Mode" it is important to not use any FPU registers with odd indices. For compiled code this has to be configured accordingly ("+nooddspreg" in clang).
When using "Half Mode" it is important to not use any FPU registers with odd indices. For compiled code this has to be configured accordingly ("+nooddspreg" in clang).
Line 249: Line 249:
''The remainder of this section documents undefined behavior. Skip this unless you are an emulator developer who cares about accuracy a little bit too much.''
''The remainder of this section documents undefined behavior. Skip this unless you are an emulator developer who cares about accuracy a little bit too much.''


If software decides to use odd indices in "Half Mode", different things happen, depending on the instruction:
Odd numbered registers (while in "Half Mode") behave differently, which is summarized in the following table:


{| class="wikitable"
{| class="wikitable"