aco: validate VOP12C opsel

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22069>
This commit is contained in:
Georg Lehmann
2023-03-21 12:07:51 +01:00
committed by Marge Bot
parent 2c49b7babf
commit 066cee0896
+10 -6
View File
@@ -223,19 +223,22 @@ validate_ir(Program* program)
}
/* check opsel */
if (instr->isVOP3()) {
VALU_instruction& vop3 = instr->valu();
check(vop3.opsel == 0 || program->gfx_level >= GFX9, "Opsel is only supported on GFX9+",
if (instr->isVOP3() || instr->isVOP1() || instr->isVOP2() || instr->isVOPC()) {
VALU_instruction& valu = instr->valu();
check(valu.opsel == 0 || program->gfx_level >= GFX9, "Opsel is only supported on GFX9+",
instr.get());
check(valu.opsel == 0 || instr->format == Format::VOP3 || program->gfx_level >= GFX11,
"Opsel is only supported for VOP3 before GFX11", instr.get());
for (unsigned i = 0; i < 3; i++) {
if (i >= instr->operands.size() ||
(!instr->isVOP3() && !instr->operands[i].isOfType(RegType::vgpr)) ||
(instr->operands[i].hasRegClass() &&
instr->operands[i].regClass().is_subdword() && !instr->operands[i].isFixed()))
check(!vop3.opsel[i], "Unexpected opsel for operand", instr.get());
check(!valu.opsel[i], "Unexpected opsel for operand", instr.get());
}
if (instr->definitions[0].regClass().is_subdword() && !instr->definitions[0].isFixed())
check(!vop3.opsel[3], "Unexpected opsel for sub-dword definition", instr.get());
check(!valu.opsel[3], "Unexpected opsel for sub-dword definition", instr.get());
} else if (instr->opcode == aco_opcode::v_fma_mixlo_f16 ||
instr->opcode == aco_opcode::v_fma_mixhi_f16 ||
instr->opcode == aco_opcode::v_fma_mix_f32) {
@@ -383,7 +386,8 @@ validate_ir(Program* program)
"Too many SGPRs/literals", instr.get());
/* Validate modifiers. */
check(!instr->valu().opsel || instr->isVOP3() || instr->isVINTERP_INREG(),
check(!instr->valu().opsel || instr->isVOP3() || instr->isVOP1() ||
instr->isVOP2() || instr->isVOPC() || instr->isVINTERP_INREG(),
"OPSEL set for unsupported instruction format", instr.get());
check(!instr->valu().opsel_lo || instr->isVOP3P(),
"OPSEL_LO set for unsupported instruction format", instr.get());