From 9af068c5e0e29b18eda5a8c223455efa1602b6ef 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: (cherry picked from commit f4ede9c10a494ca82343fdc370033f0dd9e0f0f1) --- .pick_status.json | 2 +- src/intel/compiler/elk/elk_fs.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index e028c396d11..f9c5bdfba32 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/intel/compiler/elk/elk_fs.cpp b/src/intel/compiler/elk/elk_fs.cpp index 9c27c87307b..205897b7fe8 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) {