Mesa (main): nir: fix constant expression of ibitfield_extract

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 18:02:22 UTC 2021


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Nov 15 14:37:41 2021 +0100

nir: fix constant expression of ibitfield_extract

This fixes dEQP-VK.graphicsfuzz.cov-condition-bitfield-extract-integer.

For example, nir_ibitfield_extract(3, 1, 2) should return 1.

Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13791>

---

 src/compiler/nir/nir_opcodes.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index c16923b0ee8..a104edc9882 100644
--- a/src/compiler/nir/nir_opcodes.py
+++ b/src/compiler/nir/nir_opcodes.py
@@ -1056,7 +1056,7 @@ if (bits == 0) {
 } else if (offset < 0 || bits < 0 || offset + bits > 32) {
    dst = 0;
 } else {
-   dst = (base << (32 - offset - bits)) >> offset; /* use sign-extending shift */
+   dst = (base << (32 - offset - bits)) >> (32 - bits); /* use sign-extending shift */
 }
 """)
 



More information about the mesa-commit mailing list