diff options
author | Rhys Perry <[email protected]> | 2019-11-22 14:34:24 +0000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-14 12:56:28 +0000 |
commit | dc6c35e1c328f3f2db87d9ebd55f892527071683 (patch) | |
tree | 958f755c6083adb3abefff4bf852a7ec267683e3 /src/amd/compiler | |
parent | fcf52eb42d9b3b67a5b455b8146da10314077db7 (diff) |
aco: be more careful with literals in combine_salu_{n2,lshl_add}
No pipeline-db changes.
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2883>
Diffstat (limited to 'src/amd/compiler')
-rw-r--r-- | src/amd/compiler/aco_optimizer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 387d8c76c0a..61cb58df172 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1678,6 +1678,10 @@ bool combine_salu_n2(opt_ctx& ctx, aco_ptr<Instruction>& instr) if (!op2_instr || (op2_instr->opcode != aco_opcode::s_not_b32 && op2_instr->opcode != aco_opcode::s_not_b64)) continue; + if (instr->operands[!i].isLiteral() && op2_instr->operands[0].isLiteral() && + instr->operands[!i].constantValue() != op2_instr->operands[0].constantValue()) + continue; + ctx.uses[instr->operands[i].tempId()]--; instr->operands[0] = instr->operands[!i]; instr->operands[1] = op2_instr->operands[0]; @@ -1720,6 +1724,10 @@ bool combine_salu_lshl_add(opt_ctx& ctx, aco_ptr<Instruction>& instr) if (shift < 1 || shift > 4) continue; + if (instr->operands[!i].isLiteral() && op2_instr->operands[0].isLiteral() && + instr->operands[!i].constantValue() != op2_instr->operands[0].constantValue()) + continue; + ctx.uses[instr->operands[i].tempId()]--; instr->operands[1] = instr->operands[!i]; instr->operands[0] = op2_instr->operands[0]; |