Skip to content

spirv: Fix bugs in conversions

Jesse Natalie requested to merge jenatali/mesa:conversions-fixes into msclc-d3d12
  1. Bounds for conversions to int were wrong - negatives had the wrong limit and weren't being sign extended to the source type correctly.
  2. NIR's rounding modes for f2f are different from f2i/f2u. For f2f, NIR uses RTNE, but for f2i/f2u, it uses RTZ. For undef modes, just using the nir op is fine, but when explicitly requesting a rounding mode that doesn't match NIR's default, make sure we do the right thing.
  3. We weren't handling rounding modes for i2f/u2f, where we needed to explicitly round the integer while discarding bits to fit into the significand of the float.
  4. The f2u/f2i lowering implementation for int64 needs to saturate on min/max values, since there's not enough precision in the fp32 to do that as part of the algorithm.
  5. The i2f/u2f lowering implementation for int64 had a bug. I peeled back the patch we had in our tree, and replaced it with the series from upstream, including a patch that's not yet merged which fixes the RTNE algorithm.
Edited by Jesse Natalie

Merge request reports