title: HLSL Shader Optimilation with MAD(m,a,d)
body: <p>I understand that the expression <code>x = m*a+d</code> is most efficiently written as <code>x = mad(m,a,d)</code> because at the assembly level only one instruction is needed rather than a multiply and add separately. My question regards optimally writing this expression: <code>x += m*a</code>. <strong>Should this be written as <code>x = mad(m,a,x)</code> or <code>x += m*a</code>?</strong> The difference is too subtle to profile but I'm wondering if anyone can see the difference at the assembly level. (I don't know how to view the assembly code.)</p>