Mesa (main): nir/opt_algebraic: Fix mask in shift by constant combining.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 10 19:28:32 UTC 2022
Module: Mesa
Branch: main
Commit: 66e917fff69497143ebf6593a40891ea3d1daf93
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=66e917fff69497143ebf6593a40891ea3d1daf93
Author: Georg Lehmann <dadschoorse at gmail.com>
Date: Sat Apr 16 13:36:17 2022 +0200
nir/opt_algebraic: Fix mask in shift by constant combining.
The comment above is correct, but the code to calculate the mask was broken.
No Foz-db changes outside of noise.
Fixes: 0e6581b87dc ("nir/algebraic: Reassociate shift-by-constant of shift-by-constant")
Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15990>
---
src/compiler/nir/nir_opt_algebraic.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index d0873b0e1aa..222727d4f2a 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -413,7 +413,7 @@ optimizations.extend([
# bits of the second source. These replacements must correctly handle the
# case where (b % bitsize) + (c % bitsize) >= bitsize.
for s in [8, 16, 32, 64]:
- mask = (1 << s) - 1
+ mask = s - 1
ishl = "ishl@{}".format(s)
ishr = "ishr@{}".format(s)
More information about the mesa-commit
mailing list