Mesa (staging/21.3): microsoft/compiler: Implement inot

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 24 12:37:24 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 043a5eded5591cd46745b6dc921c82b457fed528
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=043a5eded5591cd46745b6dc921c82b457fed528

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Thu Dec  9 16:27:39 2021 -0800

microsoft/compiler: Implement inot

Fixes: cb283616 ("nir/algebraic: Small optimizations for SpvOpFOrdNotEqual and SpvOpFUnordEqual")
Reviewed-by: Enrico Galli <enrico.galli at intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14140>
(cherry picked from commit 45354be410f088b7b30beca62c1ca87b598c35c1)

---

 .pick_status.json                    | 2 +-
 src/microsoft/compiler/nir_to_dxil.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 03eb1054a8d..fa3a546ced4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3199,7 +3199,7 @@
         "description": "microsoft/compiler: Implement inot",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "cb2836164251c9813469345c79a71c222a54f233"
     },
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 84d3aad16df..a2aeffe450a 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -2112,6 +2112,12 @@ emit_alu(struct ntd_context *ctx, nir_alu_instr *alu)
    case nir_op_iand: return emit_binop(ctx, alu, DXIL_BINOP_AND, src[0], src[1]);
    case nir_op_ior:  return emit_binop(ctx, alu, DXIL_BINOP_OR, src[0], src[1]);
    case nir_op_ixor: return emit_binop(ctx, alu, DXIL_BINOP_XOR, src[0], src[1]);
+   case nir_op_inot: {
+      unsigned bit_size = alu->dest.dest.ssa.bit_size;
+      intmax_t val = bit_size == 1 ? 1 : -1;
+      const struct dxil_value *negative_one = dxil_module_get_int_const(&ctx->mod, val, bit_size);
+      return emit_binop(ctx, alu, DXIL_BINOP_XOR, src[0], negative_one);
+   }
    case nir_op_ieq:  return emit_cmp(ctx, alu, DXIL_ICMP_EQ, src[0], src[1]);
    case nir_op_ine:  return emit_cmp(ctx, alu, DXIL_ICMP_NE, src[0], src[1]);
    case nir_op_ige:  return emit_cmp(ctx, alu, DXIL_ICMP_SGE, src[0], src[1]);



More information about the mesa-commit mailing list