aco: fix neg(abs(mul(a, b))) if the mul is not VOP3

Previously, is_abs was just ignored if mul_instr->isVOP3()==false.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 93c8ebfa78 ("aco: Initial commit of independent AMD compiler")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14773>
(cherry picked from commit 452975f257)
This commit is contained in:
Rhys Perry 2022-01-28 13:48:34 +00:00 committed by Eric Engestrom
parent c975c588b1
commit 154ce77176
2 changed files with 9 additions and 5 deletions

View file

@ -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"
},

View file

@ -3326,12 +3326,16 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& 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;