GTE Flags
The GTE flags looked fairly straight forward, until I made some tests using the MVMVA opcode and got a flag mask looking like this:
0xffc00000
As you can see, all A-flags, both negative and positive, are set. All B-flags are also set, but that was expected.
Now, what can possibly be going on here? My guess is that the GTE has an internal overflow flag, and once that has been set, the GTE will keep setting A-flags for all subsequent additions performed by the MVMVA opcode. (The multiplies are likely done in parallel while the additions need to be sequential.)
Assuming the GTE uses a few additional bits when calculating, it may be doing something like this:
if (bit43 != bit44) overflow = true; if (overflow) && (bit43 == 0) negative_overflow = true; if (overflow) && (bit43 == 1) positive_overflow = true;
As a result, if you create a testcase which generates a negative overflow but in the end (after adding one or two positive values) results in a perfectly valid negative value, the GTE will set both the negative and positive A-flags.