diff options
author | Rhys Perry <[email protected]> | 2019-09-24 13:36:16 +0100 |
---|---|---|
committer | Rhys Perry <[email protected]> | 2019-10-11 14:26:58 +0000 |
commit | 45d6c69b9993b8e0f1d0ca79f8ff6ec9e02b1b4e (patch) | |
tree | b9c9ff9de4143c49b7f9743a5b894fcda8a77cd4 /src/amd/compiler/aco_optimizer.cpp | |
parent | b37857bcea79e85e9cae6dbfe858ed7aac772afe (diff) |
aco: use can_accept_constant in valu_can_accept_literal
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Diffstat (limited to 'src/amd/compiler/aco_optimizer.cpp')
-rw-r--r-- | src/amd/compiler/aco_optimizer.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index a142ccba9a1..6d600d55254 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -439,12 +439,6 @@ void to_VOP3(opt_ctx& ctx, aco_ptr<Instruction>& instr) } } -bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr) -{ - // TODO: VOP3 can take a literal on GFX10 - return !instr->isSDWA() && !instr->isDPP() && !instr->isVOP3(); -} - /* only covers special cases */ bool can_accept_constant(aco_ptr<Instruction>& instr, unsigned operand) { @@ -473,6 +467,13 @@ bool can_accept_constant(aco_ptr<Instruction>& instr, unsigned operand) } } +bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned operand) +{ + // TODO: VOP3 can take a literal on GFX10 + return !instr->isSDWA() && !instr->isDPP() && !instr->isVOP3() && + operand == 0 && can_accept_constant(instr, operand); +} + bool parse_base_offset(opt_ctx &ctx, Instruction* instr, unsigned op_index, Temp *base, uint32_t *offset) { Operand op = instr->operands[op_index]; @@ -2307,7 +2308,7 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr) if (ctx.uses[instr->operands[literal_idx].tempId()] == 0) instr->operands[literal_idx] = Operand(ctx.info[instr->operands[literal_idx].tempId()].val); } - } else if (instr->isVALU() && valu_can_accept_literal(ctx, instr) && + } else if (instr->isVALU() && valu_can_accept_literal(ctx, instr, 0) && instr->operands[0].isTemp() && ctx.info[instr->operands[0].tempId()].is_literal() && ctx.uses[instr->operands[0].tempId()] < threshold) { |