Mesa (main): aco: fix redirect combine in propagate_constants_vop3p() with negatives

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 5 17:01:39 UTC 2022


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Mon May  2 13:16:54 2022 +0100

aco: fix redirect combine in propagate_constants_vop3p() with negatives

This previously didn't correctly consider negative integers when bits=16
(which sign-extend) and would have combined 0xfffe0000.xy as -2.yx. Now it
combines 0xfffeffff.xy as that instead. It was also skipped when bits=32.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16296>

---

 src/amd/compiler/aco_optimizer.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 88440c1a7bc..82dbf8253c4 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -949,12 +949,7 @@ propagate_constants_vop3p(opt_ctx& ctx, aco_ptr<Instruction>& instr, ssa_info& i
       /* opsel must point to lo for both halves */
       vop3p->opsel_lo &= ~(1 << i);
       vop3p->opsel_hi &= ~(1 << i);
-   } else if (const_lo == Operand::c16(0)) {
-      /* don't inline FP constants into integer instructions */
-      // TODO: check if negative integers are zero- or sign-extended
-      if (bits == 32 && const_hi.constantValue() > 64u)
-         return;
-
+   } else if (const_lo.constantValue() == const_hi.constantValue16(true)) {
       instr->operands[i] = const_hi;
 
       /* redirect opsel selection */



More information about the mesa-commit mailing list