diff --git a/.pick_status.json b/.pick_status.json index d14b8d6747c..46c27f4b42e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3343,7 +3343,7 @@ "description": "aco: fix neg(abs(mul(a, b))) if the mul is not VOP3", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "93c8ebfa780ebd1495095e794731881aef29e7d3" }, diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index f532f03ae96..ceeaeaea51b 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -3326,12 +3326,16 @@ combine_instruction(opt_ctx& ctx, aco_ptr& instr) VOP3_instruction& new_mul = instr->vop3(); if (mul_instr->isVOP3()) { VOP3_instruction& mul = mul_instr->vop3(); - new_mul.neg[0] = mul.neg[0] && !is_abs; - new_mul.neg[1] = mul.neg[1] && !is_abs; - new_mul.abs[0] = mul.abs[0] || is_abs; - new_mul.abs[1] = mul.abs[1] || is_abs; + new_mul.neg[0] = mul.neg[0]; + new_mul.neg[1] = mul.neg[1]; + new_mul.abs[0] = mul.abs[0]; + new_mul.abs[1] = mul.abs[1]; new_mul.omod = mul.omod; } + if (is_abs) { + new_mul.neg[0] = new_mul.neg[1] = false; + new_mul.abs[0] = new_mul.abs[1] = true; + } new_mul.neg[0] ^= true; new_mul.clamp = false;