Module: Mesa
Branch: master
Commit: 2182bbf84f0f19846a47f0438ec702f4d862731e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2182bbf84f0f19846a47f0438ec702f4d862731e

Author: Tony Wasserka <[email protected]>
Date:   Wed Sep  2 18:28:36 2020 +0200

aco: Fix integer overflows when emitting parallel copies during RA

32-bit shifts were accidentally used before this change despite the intended
output being 64 bits.

This was observed when compiling Dolphin's ubershaders.

Cc: mesa-stable
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6568>

---

 src/amd/compiler/aco_register_allocation.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp 
b/src/amd/compiler/aco_register_allocation.cpp
index ca7a0fa4815..d5746e5a636 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -2235,11 +2235,11 @@ void register_allocation(Program *program, 
std::vector<TempSet>& live_out_per_bl
                   if (!sgpr_operands_alias_defs) {
                      unsigned reg = parallelcopy[i].first.physReg().reg();
                      unsigned size = parallelcopy[i].first.getTemp().size();
-                     sgpr_operands[reg / 64u] |= ((1u << size) - 1) << (reg % 
64u);
+                     sgpr_operands[reg / 64u] |= u_bit_consecutive64(reg % 
64u, size);
 
                      reg = parallelcopy[i].second.physReg().reg();
                      size = parallelcopy[i].second.getTemp().size();
-                     if (sgpr_operands[reg / 64u] & ((1u << size) - 1) << (reg 
% 64u))
+                     if (sgpr_operands[reg / 64u] & u_bit_consecutive64(reg % 
64u, size))
                         sgpr_operands_alias_defs = true;
                   }
                }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to