intel/brw: Move fsat instructions closer to the source
Intel GPUs have a saturate destination modifier, and brw_fs_opt_saturate_propagation
tries to replace explicit saturate operations with this destination modifier. That pass is limited in several ways. If the source of the explicit saturate is in a different block or if the source of the explicit saturate is live after the explicit saturate, brw_fs_opt_saturate_propagation
will be unable to make progress.
This optimization exists to help brw_fs_opt_saturate_propagation
make more progress. It tries to move NIR fsat
instructions to the same block that contains the definition of its source. It does this only in cases where it will not create additional live values. It also attempts to do this only in cases where the explicit saturate will ultimately be converted to a destination modifier.
The https://gitlab.freedesktop.org/idr/mesa/-/commits/wip/move-fsat branch has an extra commit that tries even harder to find fsat
instructions to move. The changes are suggested at the end of the large file comment. This ultimately hurt a few ray tracing shaders for spills and fills without much other benefit.