intel/fs: Remove condition-based restriction for cmod propagation to saturated operations
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 17 Jul 2021 01:15:50 +0000 (18:15 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 30 Aug 2021 21:00:14 +0000 (14:00 -0700)
commite6373923a764e11b6462de6abea985061ed394ba
treea6849f9cc2861cc8c49eb134f81be21d4ca869f8
parent47f0cdc44996224c63256d2991bf4497be3b38b9
intel/fs: Remove condition-based restriction for cmod propagation to saturated operations

I don't know why the float_saturate_l_mov test was #if'ed out, but it
passes... so this commit enables it.

No shader-db or fossil-db changes.

In a previous iteration of this MR, this commit helped ~200 shaders in
shader-db.  Now all of those same shaders are helped by "intel/fs: cmod
propagate from MOV with any condition".  All of these shaders come from
Mad Max.  After initial translation from NIR to assembly, these shader
contain patterns like:

    mul(8)            g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.sat(8)        g90<1>F       g90<8,8,1>F
    ...
    cmp.nz.f0(8)      null<1>F      g90<8,8,1>F     0 /* 0F */

An initial pass of cmod propagation converts this to

    mul(8)            g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.sat.XX.f0(8)  g90<1>F       g90<8,8,1>F

Without this commit, XX is G.  With this commit, XX is NZ.  Saturate
propagation moves the saturate:

    mul.sat(8)        g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */
    ...
    mov.XX.f0(8)      g90<1>F       g90<8,8,1>F

Without this commit (but with "intel/fs: cmod propagate from MOV with
any condition"), the G gets propagated:

    mul.sat.g.f0(8)   g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */

With this commit (with or without "intel/fs: cmod propagate from MOV
with any condition"), the NZ gets propagated:

    mul.sat.nz.f0(8)  g90<1>F       g88<8,8,1>F     0x40400000F  /* 3F */

Reviewed-by: Marcin Ĺšlusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12045>
src/intel/compiler/brw_fs_cmod_propagation.cpp
src/intel/compiler/test_fs_cmod_propagation.cpp