r600/sfn: override register ID when it doesn't matter
authorGert Wollny <gert.wollny@collabora.com>
Wed, 31 Aug 2022 06:13:18 +0000 (08:13 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 1 Sep 2022 08:55:07 +0000 (08:55 +0000)
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 <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18343>

src/gallium/drivers/r600/sfn/sfn_virtualvalues.cpp

index 32af047..b41e705 100644 (file)
@@ -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