aco: validate VALU modifiers

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21023>
This commit is contained in:
Georg Lehmann 2023-01-31 13:14:46 +01:00 committed by Marge Bot
parent fc193ab4db
commit 17ff2e8c52

View file

@ -382,6 +382,30 @@ validate_ir(Program* program)
}
check(num_sgprs + (literal.isUndefined() ? 0 : 1) <= const_bus_limit,
"Too many SGPRs/literals", instr.get());
/* Validate modifiers. */
check(!instr->valu().opsel || instr->isVOP3() || 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());
check(!instr->valu().opsel_hi || instr->isVOP3P(),
"OPSEL_HI set for unsupported instruction format", instr.get());
check(!instr->valu().omod || instr->isVOP3() ||instr->isSDWA(),
"OMOD set for unsupported instruction format", instr.get());
check(!instr->valu().clamp || instr->isVOP3() || instr->isVOP3P() ||
instr->isSDWA() || instr->isVINTERP_INREG(),
"CLAMP set for unsupported instruction format", instr.get());
for (bool abs : instr->valu().abs) {
check(!abs || instr->isVOP3() || instr->isVOP3P() || instr->isSDWA() ||
instr->isDPP16(),
"ABS/NEG_HI set for unsupported instruction format", instr.get());
}
for (bool neg : instr->valu().neg) {
check(!neg || instr->isVOP3() || instr->isVOP3P() || instr->isSDWA() ||
instr->isDPP16() || instr->isVINTERP_INREG(),
"NEG/NEG_LO set for unsupported instruction format", instr.get());
}
}
if (instr->isSOP1() || instr->isSOP2()) {