From 7ff34259f170fa6f6167d62c2953ddb6a4bf81b8 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 22 May 2020 15:42:39 +0100 Subject: [PATCH] aco: consider SDWA during value numbering Signed-off-by: Rhys Perry Fixes: 23ac24f5b1fdde73cf8ec1ef6cbe08d73d6776f5 ('aco: add missing conversion operations for small bitsizes') Part-of: (cherry picked from commit 5ccc7c277c86f754f40515820b27b55296107c54) --- .pick_status.json | 2 +- src/amd/compiler/aco_opt_value_numbering.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index b02eb3b8203..168fb5e6d89 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4063,7 +4063,7 @@ "description": "aco: consider SDWA during value numbering", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "23ac24f5b1fdde73cf8ec1ef6cbe08d73d6776f5" }, diff --git a/src/amd/compiler/aco_opt_value_numbering.cpp b/src/amd/compiler/aco_opt_value_numbering.cpp index 4ab3d6d56e5..487d1588128 100644 --- a/src/amd/compiler/aco_opt_value_numbering.cpp +++ b/src/amd/compiler/aco_opt_value_numbering.cpp @@ -86,6 +86,9 @@ struct InstrHash { if (instr->isDPP()) return hash_murmur_32(instr); + if (instr->isSDWA()) + return hash_murmur_32(instr); + switch (instr->format) { case Format::SMEM: return hash_murmur_32(instr); @@ -199,6 +202,20 @@ struct InstrPred { aDPP->neg[0] == bDPP->neg[0] && aDPP->neg[1] == bDPP->neg[1]; } + if (a->isSDWA()) { + SDWA_instruction* aSDWA = static_cast(a); + SDWA_instruction* bSDWA = static_cast(b); + return aSDWA->sel[0] == bSDWA->sel[0] && + aSDWA->sel[1] == bSDWA->sel[1] && + aSDWA->dst_sel == bSDWA->dst_sel && + aSDWA->abs[0] == bSDWA->abs[0] && + aSDWA->abs[1] == bSDWA->abs[1] && + aSDWA->neg[0] == bSDWA->neg[0] && + aSDWA->neg[1] == bSDWA->neg[1] && + aSDWA->dst_preserve == bSDWA->dst_preserve && + aSDWA->clamp == bSDWA->clamp && + aSDWA->omod == bSDWA->omod; + } switch (a->format) { case Format::SOPK: {