From dce56ea2d030ee2e1a3c39686ffb641bbcdcba4f Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 16 Apr 2022 13:36:17 +0200 Subject: [PATCH] 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 Reviewed-by: Jason Ekstrand Part-of: (cherry picked from commit 66e917fff69497143ebf6593a40891ea3d1daf93) --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_algebraic.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index faa72f0fcdc..1525ed5c3df 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -404,7 +404,7 @@ "description": "nir/opt_algebraic: Fix mask in shift by constant combining.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "because_sha": "0e6581b87dc4e168fa864cd39e8947a58999189a" }, { diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 54ef284b538..2b8979df15e 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -420,7 +420,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)