From 0c5b2aa429580cd993f0f678548ffd2eb9b9b4db Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 19 Apr 2021 11:32:56 +0100 Subject: [PATCH] aco: allow SDWA sels smaller than the operand size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit p_extract_vector copy-propagation can create byte sels for v2b operands. Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Cc: mesa-stable Part-of: (cherry picked from commit 2d36232e62ae7daba7ab0ed23f890d6c0e4a35c3) --- .pick_status.json | 2 +- src/amd/compiler/aco_validate.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 495ebed8f08..7752612371e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -247,7 +247,7 @@ "description": "aco: allow SDWA sels smaller than the operand size", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_validate.cpp b/src/amd/compiler/aco_validate.cpp index 5f586dccb74..15db1799e4d 100644 --- a/src/amd/compiler/aco_validate.cpp +++ b/src/amd/compiler/aco_validate.cpp @@ -549,8 +549,10 @@ bool validate_subdword_operand(chip_class chip, const aco_ptr& inst return byte == 0; if (instr->isPseudo() && chip >= GFX8) return true; - if (instr->isSDWA() && (instr->sdwa().sel[index] & sdwa_asuint) == (sdwa_isra | op.bytes())) - return true; + if (instr->isSDWA()) { + unsigned sel = instr->sdwa().sel[index] & sdwa_asuint; + return (sel & sdwa_isra) && (sel & sdwa_rasize) <= op.bytes(); + } if (byte == 2 && can_use_opsel(chip, instr->opcode, index, 1)) return true;