Mesa (master): freedreno/isa: Fix branch/jump offset encoding

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 17:50:19 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Jan 15 08:51:39 2021 -0800

freedreno/isa: Fix branch/jump offset encoding

When cross compiling with clang, `1ul` would end up 32b instead of 64b,
resulting in 32b fields (like branch/jump offsets) being encoded as
zero.  Which results in infinite loops.

Fixes: e7630ec278f ("freedreno/hw: Add isaspec mechanism for documenting/defining an ISA")
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8528>

---

 src/freedreno/isa/encode.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/freedreno/isa/encode.py b/src/freedreno/isa/encode.py
index 576fef626ac..699d5c9b660 100644
--- a/src/freedreno/isa/encode.py
+++ b/src/freedreno/isa/encode.py
@@ -345,7 +345,7 @@ struct bitset_params;
 static uint64_t
 pack_field(unsigned low, unsigned high, uint64_t val)
 {
-   val &= ((1ul << (1 + high - low)) - 1);
+   val &= ((UINT64_C(1) << (1 + high - low)) - 1);
    return val << low;
 }
 



More information about the mesa-commit mailing list