Skip to content

nouveau/mme: Fix while loops pre-Turing

Pre-Turing, we don't have a full condition built into the loop so, for mme_while(b, ine, x, y) we have to generate the following:

[top]   BR -> [cond]
        /* loop body */
[cond]  XOR tmp, x, y
        BRZ !tmp -> [top]

However, due to an accounting error, we were generating

[top]   BR -> [cond]
        /* loop body */
        XOR tmp, x, y
[cond]  BRZ !tmp -> [top]

which meant that the XOR (or ADD if one is an immediate) was getting skipped, leading to the loop either never terminating or always terminating. The way to fix this accounting error is to close the while first, then compute the condition value, then do the jump.

Edited by Faith Ekstrand

Merge request reports