From 4b458b3e8f5fb01c23677a905554c070a8809fba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 17 Oct 2019 15:06:48 +0200 Subject: [PATCH] aco: don't combine minmax3 if there is a neg or abs modifier in between This fixes a graphical corruption in HotS. No pipelinedb changes other than that. Reviewed-by: Rhys Perry --- src/amd/compiler/aco_optimizer.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 6d600d55254..501e48162be 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1483,34 +1483,6 @@ void create_vop3_for_op3(opt_ctx& ctx, aco_opcode opcode, aco_ptr& instr.reset(new_instr); } -bool combine_minmax3(opt_ctx& ctx, aco_ptr& instr, aco_opcode new_op) -{ - uint32_t omod_clamp = ctx.info[instr->definitions[0].tempId()].label & - (label_omod_success | label_clamp_success); - - for (unsigned swap = 0; swap < 2; swap++) { - Operand operands[3]; - bool neg[3], abs[3], opsel[3], clamp, inbetween_neg, inbetween_abs; - unsigned omod; - if (match_op3_for_vop3(ctx, instr->opcode, instr->opcode, instr.get(), swap, - "012", operands, neg, abs, opsel, - &clamp, &omod, &inbetween_neg, &inbetween_abs, NULL)) { - ctx.uses[instr->operands[swap].tempId()]--; - neg[1] ^= inbetween_neg; - neg[2] ^= inbetween_neg; - abs[1] |= inbetween_abs; - abs[2] |= inbetween_abs; - create_vop3_for_op3(ctx, new_op, instr, operands, neg, abs, opsel, clamp, omod); - if (omod_clamp & label_omod_success) - ctx.info[instr->definitions[0].tempId()].set_omod_success(instr.get()); - if (omod_clamp & label_clamp_success) - ctx.info[instr->definitions[0].tempId()].set_clamp_success(instr.get()); - return true; - } - } - return false; -} - bool combine_three_valu_op(opt_ctx& ctx, aco_ptr& instr, aco_opcode op2, aco_opcode new_op, const char *shuffle, uint8_t ops) { uint32_t omod_clamp = ctx.info[instr->definitions[0].tempId()].label & @@ -2202,7 +2174,7 @@ void combine_instruction(opt_ctx &ctx, aco_ptr& instr) bool some_gfx9_only; if (get_minmax_info(instr->opcode, &min, &max, &min3, &max3, &med3, &some_gfx9_only) && (!some_gfx9_only || ctx.program->chip_class >= GFX9)) { - if (combine_minmax3(ctx, instr, instr->opcode == min ? min3 : max3)) ; + if (combine_three_valu_op(ctx, instr, instr->opcode, instr->opcode == min ? min3 : max3, "012", 1 | 2)); else combine_clamp(ctx, instr, min, max, med3); } } -- 2.30.2