Mesa (master): panfrost: Fix size assertion in bi_alu_src_index

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 13 04:11:07 UTC 2021


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

Author: Icecream95 <ixn at disroot.org>
Date:   Wed Jan 13 14:13:47 2021 +1300

panfrost: Fix size assertion in bi_alu_src_index

Shifting by the bitsize was not only wrong, the shift is undefined
behavior when bitsize is 32, causing the assertion to fire on AArch32.

Fixes: 95d62ee7cfa ("pan/bi: Add bi_alu_src_index helper")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8460>

---

 src/panfrost/bifrost/bifrost_compile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 55a17f3bf35..22a196c2fe6 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -740,7 +740,7 @@ bi_alu_src_index(nir_alu_src src, unsigned comps)
         assert(idx.swizzle == BI_SWIZZLE_H01);
 
         /* Bigger vectors should have been lowered */
-        assert(comps <= (1 << bitsize));
+        assert(comps <= (1 << subword_shift));
 
         if (bitsize == 16) {
                 unsigned c0 = src.swizzle[0] & 1;



More information about the mesa-commit mailing list