Skip to content

intel/compiler: Properly handle shift count for 8-bit sources

Ian Romanick requested to merge idr/mesa:review/shift-int8 into master

This fixes the Crucible func.shader.shift.int8_t test on Gen8 and Gen9. See crucible!76 (merged).

No changes in fossil-db because there are no shaders in fossil-db that use shaderInt8. :(

A couple alternatives were considered.

  1. Lower 8-bit integers to 16-bit on all platforms. I looked at the output of a few shaders from the Vulkan CTS, and it was a mess. There were so many extra type converting MOVs. I think all of that could be cleaned up, but it would be more work. It would also not be great for cherry-picking to a stable branch.

  2. Disable the optimization that prunes the & 7. This would be more optimal in shaders that don't have the explicit mask, but it's not very future proof. It would potentially require auditing future optimizations to make sure they don't run afoul of this problem.

In the end, the easiest solution seems to be adding the extra mask to implement the specified semantics of the NIR shift instructions... especially since the only shaders we have that use shaderInt8 are from the CTS.

Merge request reports