From e41eb8950b0c8bb19f0298fe387fe31a0c4fc343 Mon Sep 17 00:00:00 2001 From: "Thomas H.P. Andersen" Date: Tue, 29 Jun 2021 00:54:40 +0200 Subject: [PATCH] nir/ifind_msb_rev: fix input check ifind_msb_rev was introduced in a5747f8ab357ff00c630b937b221e5fb59d90289. ifind_msb_rev guards against src0 being both 0 or -1 at the same time. That is always true. This patch changes it to check for those values individually. Spotted from a compile warning. Reviewed-by: Ian Romanick Fixes: a5747f8ab35 (\"nir: add opcodes for *find_msb_rev and lowering\") Part-of: (cherry picked from commit ffea62260415c9e1b5c8fa076ac0285c0145447e) --- .pick_status.json | 2 +- src/compiler/nir/nir_opcodes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index aa65ffb077d..94f67c1f659 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4036,7 +4036,7 @@ "description": "nir/ifind_msb_rev: fix input check", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a5747f8ab357ff00c630b937b221e5fb59d90289" }, diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 88194f762f0..b977e17a8e8 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -489,7 +489,7 @@ for (int bit = 31; bit >= 0; bit--) { unop_convert("ifind_msb_rev", tint32, tuint, """ dst = -1; -if (src0 != 0 || src0 != -1) { +if (src0 != 0 && src0 != -1) { for (int bit = 0; bit < 31; bit++) { /* If src0 < 0, we're looking for the first 0 bit. * if src0 >= 0, we're looking for the first 1 bit.