From 066cee089634079033106babd7c96b127c07e4e1 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Tue, 21 Mar 2023 12:07:51 +0100 Subject: [PATCH] aco: validate VOP12C opsel Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_validate.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index 7bccaa2..f87fcdb 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -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()); -- 2.7.4