Module: Mesa
Branch: staging/22.2
Commit: c559159b71d8e856cb53a5014ad299e55bbbb14c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c559159b71d8e856cb53a5014ad299e55bbbb14c

Author: Gert Wollny <[email protected]>
Date:   Wed Aug 31 08:13:18 2022 +0200

r600/sfn: override register ID when it doesn't matter

When a vec4 register only uses constant value of ignore
swizzles then emit zero as register ID.

Optimizing the register use in instructions that support this type
of swizzle may lead to the situation that the RA doesn't see the
register ID, because it is actually irreleant, in this case return
zero as register ID to avoid that the assembler uselessly reports
a high requirement for registers based on a stale register ID.

Fixes: 79ca456b4837b3bc21cf9ef3c03c505c4b4909f6
   r600/sfn: rewrite NIR backend

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18343>
(cherry picked from commit ed294e08635c4fea4f9a6afcf253691458c415e2)

---

 .pick_status.json                                  | 2 +-
 src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 055df55fac1..a5b13e3196e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -7060,7 +7060,7 @@
         "description": "r600/sfn: override register ID when it doesn't matter",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "79ca456b4837b3bc21cf9ef3c03c505c4b4909f6"
     },
diff --git a/src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp 
b/src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp
index 32af0477c8f..b41e705b0df 100644
--- a/src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp
@@ -433,7 +433,7 @@ int RegisterVec4::sel() const
    int comp = 0;
    while (comp < 4 && m_values[comp]->value()->chan() > 3)
       ++comp;
-   return m_values[comp < 4 ? comp : 0]->value()->sel();
+   return comp < 4 ? m_values[comp]->value()->sel() : 0;
 }
 
 bool RegisterVec4::ready(int block_id, int index) const

Reply via email to