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>
This commit is contained in:
Samuel Pitoiset
2021-11-15 14:37:41 +01:00
committed by Marge Bot
parent 8a11d2a31b
commit 011ea32585

View File

@@ -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 */
}
""")