Writing Expressions in MAD Form

To take advantage of the USC cores, it is essential to always write math expressions in Multiply-Add form (MAD form).

For example, changing the following expression to use the MAD form results in a 50% cycle cost reduction:

fragColor.x = (t.x + t.y) * (t.x - t.y); // two cycles
{sop, sop, sopmov}
{sop, sop}
-->
fragColor.x = t.x * t.x + (-t.y * t.y); // one cycle
{sop, sop}