nir: Fix constant folding for irhadd/urhadd
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 30 Jun 2021 22:16:55 +0000 (18:16 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 2 Jul 2021 00:21:22 +0000 (00:21 +0000)
commit3da23a9c7e6f34ea50c1ba415991c7ff1b443ef6
tree01f0bef7110533113a2c579d2a0b33fa3ccc34a4
parentce90f73eb0fb3d7e2de5aeef2e8094cae0a73e48
nir: Fix constant folding for irhadd/urhadd

This should be a subtract, not an add. The comment's proof is correct,
but the (wrong) expression we actually use isn't what it's in the
comment! Correct the discrepancy.

The lowering in nir_opt_algebraic was correctly typed.

Fixes: 272e927d0e9 ("nir/spirv: initial handling of OpenCL.std extension opcodes")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11671>
src/compiler/nir/nir_opcodes.py