From ad4e104bb98019d51b1f20798c0754f2e051a8cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 27 Feb 2020 13:08:45 +0100 Subject: [PATCH] aco: validate p_create_vector with subdword elements properly MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Also allows for undef operands Reviewed-by: Rhys Perry Reviewed-By: Timur Kristóf Part-of: --- src/amd/compiler/aco_validate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index dd13fa34ed6..68e0c9caf8b 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -150,6 +150,7 @@ void validate(Program* program, FILE * output) bool flat = instr->format == Format::FLAT || instr->format == Format::SCRATCH || instr->format == Format::GLOBAL; bool can_be_undef = is_phi(instr) || instr->format == Format::EXP || instr->format == Format::PSEUDO_REDUCTION || + instr->opcode == aco_opcode::p_create_vector || (flat && i == 1) || (instr->format == Format::MIMG && i == 1) || ((instr->format == Format::MUBUF || instr->format == Format::MTBUF) && i == 1); check(can_be_undef, "Undefs can only be used in certain operands", instr.get()); @@ -241,9 +242,9 @@ void validate(Program* program, FILE * output) if (instr->opcode == aco_opcode::p_create_vector) { unsigned size = 0; for (const Operand& op : instr->operands) { - size += op.size(); + size += op.bytes(); } - check(size == instr->definitions[0].size(), "Definition size does not match operand sizes", instr.get()); + check(size == instr->definitions[0].bytes(), "Definition size does not match operand sizes", instr.get()); if (instr->definitions[0].getTemp().type() == RegType::sgpr) { for (const Operand& op : instr->operands) { check(op.isConstant() || op.regClass().type() == RegType::sgpr, -- 2.30.2