Mesa (staging/21.3): nir: fix constant expression of ibitfield_extract

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


Module: Mesa
Branch: staging/21.3
Commit: 157de0e5effadc68f43142b916628338af874fc3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=157de0e5effadc68f43142b916628338af874fc3

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>
(cherry picked from commit 011ea325855d4dfd1b75f3c1c80a8f5a24c8a7c7)

---

 .pick_status.json               | 2 +-
 src/compiler/nir/nir_opcodes.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index df17a507184..f3a55f63275 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -76,7 +76,7 @@
         "description": "nir: fix constant expression of ibitfield_extract",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
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