Mesa (main): aco/optimizer: ensure to not erase high bits when propagating packed constants

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 20 08:05:35 UTC 2021


Module: Mesa
Branch: main
Commit: 9b1a296172df38561d650abf98ee2e1c77ac6fc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b1a296172df38561d650abf98ee2e1c77ac6fc2

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Mon Jul 19 15:01:09 2021 +0200

aco/optimizer: ensure to not erase high bits when propagating packed constants

Packed constants with non-zero values in the high half
might have been propagated as 16 bit, dropping the high half.

Cc: mesa-stable
Closes: #5070
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11954>

---

 src/amd/compiler/aco_optimizer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 8e4daaa8167..f6198e4b465 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -194,7 +194,8 @@ struct ssa_info {
       add_label(label_literal);
       val = constant;
 
-      if (chip >= GFX8 && !op16.isLiteral())
+      /* check that no upper bits are lost in case of packed 16bit constants */
+      if (chip >= GFX8 && !op16.isLiteral() && op16.constantValue64() == constant)
          add_label(label_constant_16bit);
 
       if (!op32.isLiteral())



More information about the mesa-commit mailing list