summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2021-11-15 14:37:41 +0100
committerEric Engestrom <eric@engestrom.ch>2021-11-17 20:06:22 +0000
commitb7ac49468be45ba640ba3c6ec627fc8b3624ef3b (patch)
treeb209f3a1cbc9f910d30b9efc115f55bd208cb5ad
parent02dc554b21786a5415224655fad0a6527968322f (diff)
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@gmail.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13791> (cherry picked from commit 011ea325855d4dfd1b75f3c1c80a8f5a24c8a7c7)
-rw-r--r--.pick_status.json2
-rw-r--r--src/compiler/nir/nir_opcodes.py2
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 */
}
""")