Division¶

It is usually better to write division math in reciprocal form as the reciprocal form is directly supported by an instruction (RCP).

Finishing math expressions’ simplification can give further performance gains.

fragColor.x = (t.x * t.y + t.z) / t.x; // three cycles
{sop, sop, sopmov}
{frcp}
{sop, sop}
-->
fragColor.x = t.y + t.z * (1.0 / t.x); // two cycles
{frcp}
{sop, sop}

// Instructions on Volcanic:
fragColor.x = (t.x * t.y + t.z) / t.x;
{rcp}
{fma}
{mul}
-->
fragColor.x = t.y + t.z * (1.0 / t.x);
{rcp}
{fma}