From 011ea325855d4dfd1b75f3c1c80a8f5a24c8a7c7 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 15 Nov 2021 14:37:41 +0100 Subject: [PATCH] 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 Reviewed-by: Rhys Perry Part-of: --- 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 */ } """)