Module: Mesa Branch: staging/23.0 Commit: 3e383010d1b59fd33f21b19a7b8c0f7744965900 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e383010d1b59fd33f21b19a7b8c0f7744965900
Author: Lionel Landwerlin <[email protected]> Date: Tue Mar 7 17:54:16 2023 +0200 intel/fs: fixup sources number from opt_algebraic Fixes issues with register_coalesce : fossilize-replay: brw_fs_register_coalesce.cpp:297: bool fs_visitor::register_coalesce(): Assertion `mov[i]->sources == 1' failed. Signed-off-by: Lionel Landwerlin <[email protected]> Cc: mesa-stable Reviewed-by: Marcin Ĺšlusarz <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21782> (cherry picked from commit ed3c2f73dbb161e882bcda978aac3011a4d51839) --- .pick_status.json | 2 +- src/intel/compiler/brw_fs.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 44f2aaa9eb1..63f81c3b2dc 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6259,7 +6259,7 @@ "description": "intel/fs: fixup sources number from opt_algebraic", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 1df35f3568f..03d947ff74f 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2634,6 +2634,7 @@ fs_visitor::opt_algebraic() /* a * 1.0 = a */ if (inst->src[1].is_one()) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[1] = reg_undef; progress = true; break; @@ -2642,6 +2643,7 @@ fs_visitor::opt_algebraic() /* a * -1.0 = -a */ if (inst->src[1].is_negative_one()) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[0].negate = !inst->src[0].negate; inst->src[1] = reg_undef; progress = true; @@ -2656,6 +2658,7 @@ fs_visitor::opt_algebraic() if (brw_reg_type_is_integer(inst->src[1].type) && inst->src[1].is_zero()) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[1] = reg_undef; progress = true; break; @@ -2664,6 +2667,7 @@ fs_visitor::opt_algebraic() if (inst->src[0].file == IMM) { assert(inst->src[0].type == BRW_REGISTER_TYPE_F); inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[0].f += inst->src[1].f; inst->src[1] = reg_undef; progress = true; @@ -2679,9 +2683,11 @@ fs_visitor::opt_algebraic() */ if (inst->src[0].negate) { inst->opcode = BRW_OPCODE_NOT; + inst->sources = 1; inst->src[0].negate = false; } else { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; } inst->src[1] = reg_undef; progress = true; @@ -2728,6 +2734,7 @@ fs_visitor::opt_algebraic() } if (inst->src[0].equals(inst->src[1])) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[1] = reg_undef; inst->predicate = BRW_PREDICATE_NONE; inst->predicate_inverse = false; @@ -2740,6 +2747,7 @@ fs_visitor::opt_algebraic() case BRW_REGISTER_TYPE_F: if (inst->src[1].f >= 1.0f) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[1] = reg_undef; inst->conditional_mod = BRW_CONDITIONAL_NONE; progress = true; @@ -2755,6 +2763,7 @@ fs_visitor::opt_algebraic() case BRW_REGISTER_TYPE_F: if (inst->src[1].f <= 0.0f) { inst->opcode = BRW_OPCODE_MOV; + inst->sources = 1; inst->src[1] = reg_undef; inst->conditional_mod = BRW_CONDITIONAL_NONE; progress = true; @@ -2775,11 +2784,13 @@ fs_visitor::opt_algebraic() break; if (inst->src[1].is_one()) { inst->opcode = BRW_OPCODE_ADD; + inst->sources = 2; inst->src[1] = inst->src[2]; inst->src[2] = reg_undef; progress = true; } else if (inst->src[2].is_one()) { inst->opcode = BRW_OPCODE_ADD; + inst->sources = 2; inst->src[2] = reg_undef; progress = true; }
