diff options
author | Rhys Perry <[email protected]> | 2020-05-19 11:45:12 +0100 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-15 18:24:22 +0000 |
commit | 575b431c80170c2f3234e996947b363c4db5dcb9 (patch) | |
tree | 22f26d66da129102e6d3b15cf670bf70c21e243f /src/amd/compiler/aco_validate.cpp | |
parent | d16a7190a309ba87dc52760999dd3a6c033143ef (diff) |
aco: validate sub-dword pseudo instructions
No fossil-db changes.
Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5245>
Diffstat (limited to 'src/amd/compiler/aco_validate.cpp')
-rw-r--r-- | src/amd/compiler/aco_validate.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index d4ba88e014a..53c16bc5ac7 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -272,6 +272,24 @@ void validate(Program* program, FILE * output) switch (instr->format) { case Format::PSEUDO: { + bool is_subdword = false; + bool has_const_sgpr = false; + bool has_literal = false; + for (Definition def : instr->definitions) + is_subdword |= def.regClass().is_subdword(); + for (unsigned i = 0; i < instr->operands.size(); i++) { + if (instr->opcode == aco_opcode::p_extract_vector && i == 1) + continue; + Operand op = instr->operands[i]; + is_subdword |= op.hasRegClass() && op.regClass().is_subdword(); + has_const_sgpr |= op.isConstant() || (op.hasRegClass() && op.regClass().type() == RegType::sgpr); + has_literal |= op.isLiteral(); + } + + check(!is_subdword || !has_const_sgpr || program->chip_class >= GFX9, + "Sub-dword pseudo instructions can only take constants or SGPRs on GFX9+", instr.get()); + check(!is_subdword || !has_literal, "Sub-dword pseudo instructions cannot take literals", instr.get()); + if (instr->opcode == aco_opcode::p_create_vector) { unsigned size = 0; for (const Operand& op : instr->operands) { |