From abfe28a6bb637237b3a6873eda8b09cfe4faf1e2 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 17 Jun 2020 14:50:10 +0100 Subject: [PATCH] aco: fix validation of opsel when set for the definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_validate.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index 90272433f85..b7c773ca8f6 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -159,11 +159,11 @@ void validate(Program* program, FILE * output) if (instr->isVOP3()) { VOP3A_instruction *vop3 = static_cast(instr.get()); check(vop3->opsel == 0 || program->chip_class >= GFX9, "Opsel is only supported on GFX9+", instr.get()); - check((vop3->opsel & ~(0x10 | ((1 << instr->operands.size()) - 1))) == 0, "Unused bits in opsel must be zeroed out", instr.get()); - for (unsigned i = 0; i < instr->operands.size(); i++) { - if (instr->operands[i].hasRegClass() && instr->operands[i].regClass().is_subdword() && !instr->operands[i].isFixed()) - check((vop3->opsel & (1 << i)) == 0, "Unexpected opsel for sub-dword operand", instr.get()); + for (unsigned i = 0; i < 3; i++) { + if (i >= instr->operands.size() || + (instr->operands[i].hasRegClass() && instr->operands[i].regClass().is_subdword() && !instr->operands[i].isFixed())) + check((vop3->opsel & (1 << i)) == 0, "Unexpected opsel for operand", instr.get()); } if (instr->definitions[0].regClass().is_subdword() && !instr->definitions[0].isFixed()) check((vop3->opsel & (1 << 3)) == 0, "Unexpected opsel for sub-dword definition", instr.get()); -- 2.30.2