elk/algebraic: Clear condition modifier on optimized SEL instruction

The condition modifier on SEL means something completely different than
it means on MOV.  On MOV it means to modify the flags based on the value
written to the destination. On SEL it means to compare the sources using
that mode and pick the result (i.e., as min() or max()) without
modifying the flags.

The resulting MOV should not have a condition modifier for the same
reason it (already) doesn't have a predicate. This bug was found by
inspection, so I added a unit test.

Fixes: fab92fa1cb ("i965/fs: Optimize SEL with the same sources into a MOV.")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34192>
(cherry picked from commit f4ede9c10a)
This commit is contained in:
Ian Romanick 2025-03-10 18:17:58 -07:00 committed by Eric Engestrom
parent ce96dcf1a6
commit 9af068c5e0
2 changed files with 2 additions and 1 deletions

View file

@ -2994,7 +2994,7 @@
"description": "elk/algebraic: Clear condition modifier on optimized SEL instruction",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "fab92fa1cba4196a4947731e7105bd1494dfffc4",
"notes": null

View file

@ -2403,6 +2403,7 @@ elk_fs_visitor::opt_algebraic()
inst->src[1] = reg_undef;
inst->predicate = ELK_PREDICATE_NONE;
inst->predicate_inverse = false;
inst->conditional_mod = ELK_CONDITIONAL_NONE;
progress = true;
} else if (inst->saturate && inst->src[1].file == IMM) {
switch (inst->conditional_mod) {