aco: don't combine literals into v_cndmask_b32/v_subb/v_addc
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 11 Nov 2019 14:15:04 +0000 (14:15 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Fri, 15 Nov 2019 17:36:21 +0000 (17:36 +0000)
No pipeline-db changes

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 93c8ebfa ('aco: Initial commit of independent AMD compiler')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
src/amd/compiler/aco_optimizer.cpp

index d3b35761704874253796fe4d8b9445bac53d4e15..5b4fcf751262c6366747ac83cb3d5ff3e2fd77f2 100644 (file)
@@ -481,6 +481,12 @@ bool can_accept_constant(aco_ptr<Instruction>& instr, unsigned operand)
 
 bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned operand)
 {
+   /* instructions like v_cndmask_b32 can't take a literal because they always
+    * read SGPRs */
+   if (instr->operands.size() >= 3 &&
+       instr->operands[2].isTemp() && instr->operands[2].regClass().type() == RegType::sgpr)
+      return false;
+
    // TODO: VOP3 can take a literal on GFX10
    return !instr->isSDWA() && !instr->isDPP() && !instr->isVOP3() &&
           operand == 0 && can_accept_constant(instr, operand);