5 Replies Latest reply on Aug 16, 2018 7:27 AM by dipak

    HLSL compiler not generating FMA instruction

    giordi91

      Good morning, during a shader optimization pass, I noticed that the AMD shader compiler was not generating FMA instructions.

      The case was really simple given the source code:

       

      myValue.xy = (anototherValue.xy + 1.0f) * 0.5f;

       

      I was not able to generate FMA instruction unless myValue (which is a float4) was fully initialized, something like adding before myValue.zw = 1.0f;.

      I have written a blog post about it at length, with all the different disassemblies.

      HLSL: Will it MAD/FMA ?

       

      What I would like to know if it is a compiler bug, or if there is a specific reason I might not know behind that behavior?

       

      PS: Is it there a dedicated HLSL/DirectX forum or is this the closest matching one?