Module: Mesa
Branch: main
Commit: 37545418cd37ff5a26e758262a7b5581ef23e8a3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=37545418cd37ff5a26e758262a7b5581ef23e8a3

Author: Mike Blumenkrantz <[email protected]>
Date:   Wed May  5 14:14:13 2021 -0400

nir: add nir_isub_imm

Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
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)
 {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to