From f4ede9c10a494ca82343fdc370033f0dd9e0f0f1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 10 Mar 2025 18:17:58 -0700 Subject: [PATCH] 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: fab92fa1cba ("i965/fs: Optimize SEL with the same sources into a MOV.") Reviewed-by: Ivan Briano Part-of: --- src/intel/compiler/elk/elk_fs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/intel/compiler/elk/elk_fs.cpp b/src/intel/compiler/elk/elk_fs.cpp index e077845bb98..46e4ac91f8d 100644 --- a/src/intel/compiler/elk/elk_fs.cpp +++ b/src/intel/compiler/elk/elk_fs.cpp @@ -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) {