aco/gfx11+: apply neg to vinterp

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30350>
This commit is contained in:
Georg Lehmann 2024-07-24 18:10:12 +02:00 committed by Marge Bot
parent b8aeea806a
commit 62fa5b9d6f
3 changed files with 13 additions and 3 deletions

View file

@ -828,6 +828,12 @@ get_operand_size(aco_ptr<Instruction>& instr, unsigned index)
instr->opcode == aco_opcode::v_fma_mixlo_f16 ||
instr->opcode == aco_opcode::v_fma_mixhi_f16)
return instr->valu().opsel_hi[index] ? 16 : 32;
else if (instr->opcode == aco_opcode::v_interp_p10_f16_f32_inreg ||
instr->opcode == aco_opcode::v_interp_p10_rtz_f16_f32_inreg)
return index == 1 ? 32 : 16;
else if (instr->opcode == aco_opcode::v_interp_p2_f16_f32_inreg ||
instr->opcode == aco_opcode::v_interp_p2_rtz_f16_f32_inreg)
return index == 0 ? 16 : 32;
else if (instr->isVALU() || instr->isSALU())
return instr_info.operand_size[(int)instr->opcode];
else

View file

@ -261,7 +261,9 @@ class Instruction(object):
self.operand_size = 0
elif 'sad_' in name:
self.operand_size = 32
elif name in ['v_mad_u64_u32', 'v_mad_i64_i32']:
elif name in ['v_mad_u64_u32', 'v_mad_i64_i32',
'v_interp_p10_f16_f32_inreg', 'v_interp_p10_rtz_f16_f32_inreg',
'v_interp_p2_f16_f32_inreg', 'v_interp_p2_rtz_f16_f32_inreg']:
self.operand_size = 0
elif self.operand_size == 24:
self.operand_size = 32
@ -1244,7 +1246,7 @@ VINTERP = {
("v_interp_p2_rtz_f16_f32_inreg", op(gfx11=0x05)),
}
for (name, num) in VINTERP:
insn(name, num, Format.VINTERP_INREG, InstrClass.Valu32, False, True, definitions = dst(1), operands = src(1, 1, 1))
insn(name, num, Format.VINTERP_INREG, InstrClass.Valu32, True, True, definitions = dst(1), operands = src(1, 1, 1))
# VOP3 instructions: 3 inputs, 1 output

View file

@ -469,7 +469,7 @@ can_use_VOP3(opt_ctx& ctx, const aco_ptr<Instruction>& instr)
if (instr->isVOP3())
return true;
if (instr->isVOP3P())
if (instr->isVOP3P() || instr->isVINTERP_INREG())
return false;
if (instr->operands.size() && instr->operands[0].isLiteral() && ctx.program->gfx_level < GFX10)
@ -1361,6 +1361,8 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
can_use_mod &= instr->sdwa().sel[i].size() == 4;
else if (instr->isVOP3P())
can_use_mod &= !packed_math || !info.is_abs();
else if (instr->isVINTERP_INREG())
can_use_mod &= !info.is_abs();
else
can_use_mod &= instr->isDPP16() || can_use_VOP3(ctx, instr);