From 0e0a49039b617ef1dadc912adc34776be6e06a34 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 6 Dec 2021 13:58:25 -0800 Subject: [PATCH] r300: Turn a comment about presub into an assert. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/r300/compiler/radeon_optimize.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index 5e3503b2129..df95684fcf7 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -496,14 +496,18 @@ static int presub_helper( return 1; } -/* This function assumes that inst_add->U.I.SrcReg[0] and - * inst_add->U.I.SrcReg[1] aren't both negative. */ static void presub_replace_add( struct rc_instruction * inst_add, struct rc_instruction * inst_reader, unsigned int src_index) { rc_presubtract_op presub_opcode; + + /* This function assumes that inst_add->U.I.SrcReg[0] and + * inst_add->U.I.SrcReg[1] aren't both negative. + */ + assert(!(inst_add->U.I.SrcReg[1].Negate && inst_add->U.I.SrcReg[0].Negate)); + if (inst_add->U.I.SrcReg[1].Negate || inst_add->U.I.SrcReg[0].Negate) presub_opcode = RC_PRESUB_SUB; else