Mesa (main): nir: add nir_isub_imm
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu May 6 13:26:34 UTC 2021
Module: Mesa
Branch: main
Commit: 37545418cd37ff5a26e758262a7b5581ef23e8a3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=37545418cd37ff5a26e758262a7b5581ef23e8a3
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed May 5 14:14:13 2021 -0400
nir: add nir_isub_imm
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10654>
---
src/compiler/nir/nir_builder.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 602ab502c5e..873c91252a2 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -838,6 +838,13 @@ nir_ieq_imm(nir_builder *build, nir_ssa_def *x, uint64_t y)
return nir_ieq(build, x, nir_imm_intN_t(build, y, x->bit_size));
}
+/* Use nir_iadd(x, -y) for reversing parameter ordering */
+static inline nir_ssa_def *
+nir_isub_imm(nir_builder *build, uint64_t y, nir_ssa_def *x)
+{
+ return nir_isub(build, nir_imm_intN_t(build, y, x->bit_size), x);
+}
+
static inline nir_ssa_def *
_nir_mul_imm(nir_builder *build, nir_ssa_def *x, uint64_t y, bool amul)
{
More information about the mesa-commit
mailing list