aco: fix combining max(-min(a, b), c) if a or b uses the neg modifier

No fossils-db changes.

Cc: 20.2, 20.3
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7657>
This commit is contained in:
Samuel Pitoiset
2020-11-17 17:14:49 +01:00
committed by Marge Bot
parent ff22fcf450
commit 0fcd379184
2 changed files with 27 additions and 4 deletions
+4 -4
View File
@@ -2106,8 +2106,8 @@ bool combine_minmax(opt_ctx& ctx, aco_ptr<Instruction>& instr, aco_opcode opposi
if (combine_three_valu_op(ctx, instr, instr->opcode, minmax3, "012", 1 | 2))
return true;
/* min(-max(a, b), c) -> min3(-a, -b, c) *
* max(-min(a, b), c) -> max3(-a, -b, c) */
/* min(-max(a, b), c) -> min3(c, -a, -b) *
* max(-min(a, b), c) -> max3(c, -a, -b) */
for (unsigned swap = 0; swap < 2; swap++) {
Operand operands[3];
bool neg[3], abs[3], clamp, precise;
@@ -2119,8 +2119,8 @@ bool combine_minmax(opt_ctx& ctx, aco_ptr<Instruction>& instr, aco_opcode opposi
&clamp, &omod, &inbetween_neg, NULL, NULL, &precise) &&
inbetween_neg) {
ctx.uses[instr->operands[swap].tempId()]--;
neg[1] = true;
neg[2] = true;
neg[1] = !neg[1];
neg[2] = !neg[2];
create_vop3_for_op3(ctx, minmax3, instr, operands, neg, abs, opsel, clamp, omod);
return true;
}