From 9d5a4e0e0221b25cb458c69bbd635da19352d8f7 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Thu, 20 Jul 2023 23:04:44 +0200 Subject: [PATCH] aco: fix nir_op_vec8/16 with 16-bit elements. Fixes: 5718347c2b4 ("aco: implement vec2/3/4 with subdword operands") Part-of: (cherry picked from commit 2fcf7c7014e72826d7d38fb63534fa9a9e1bee88) --- .pick_status.json | 2 +- src/amd/compiler/aco_instruction_selection.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f3b062aa2ef..198441bba7c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -14664,7 +14664,7 @@ "description": "aco: fix nir_op_vec8/16 with 16-bit elements.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "5718347c2b42ee25e5377d40024aaaa929889c44", "notes": null diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index b349f15c2c2..d94eedad1af 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -1462,11 +1462,14 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr) if (dst.size() == 1) bld.copy(Definition(dst), packed[0]); - else if (dst.size() == 2) - bld.pseudo(aco_opcode::p_create_vector, Definition(dst), packed[0], packed[1]); - else - bld.pseudo(aco_opcode::p_create_vector, Definition(dst), packed[0], packed[1], - packed[2]); + else { + aco_ptr vec{create_instruction( + aco_opcode::p_create_vector, Format::PSEUDO, dst.size(), 1)}; + vec->definitions[0] = Definition(dst); + for (unsigned i = 0; i < dst.size(); ++i) + vec->operands[i] = Operand(packed[i]); + bld.insert(std::move(vec)); + } } break; }