From ed3c2f73dbb161e882bcda978aac3011a4d51839 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 7 Mar 2023 17:54:16 +0200 Subject: [PATCH] intel/fs: fixup sources number from opt_algebraic MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Cc: mesa-stable Reviewed-by: Marcin Ślusarz Part-of: --- src/intel/compiler/brw_fs.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index 054716a..72ed143 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -2614,6 +2614,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; @@ -2622,6 +2623,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; @@ -2636,6 +2638,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; @@ -2644,6 +2647,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; @@ -2659,9 +2663,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; @@ -2708,6 +2714,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; @@ -2720,6 +2727,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; @@ -2735,6 +2743,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; @@ -2755,11 +2764,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; } -- 2.7.4