Mesa (main): microsoft/compiler: Implement inot

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 10 23:45:34 UTC 2021


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

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>

---

 src/microsoft/ci/spirv2dxil_reference.txt | 16 ++++++++--------
 src/microsoft/compiler/nir_to_dxil.c      |  6 ++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/microsoft/ci/spirv2dxil_reference.txt b/src/microsoft/ci/spirv2dxil_reference.txt
index 576426e6d93..744f3b9a789 100644
--- a/src/microsoft/ci/spirv2dxil_reference.txt
+++ b/src/microsoft/ci/spirv2dxil_reference.txt
@@ -376,11 +376,11 @@ Assertion failed: glsl_get_components(type) == 4, file ../src/microsoft/compiler
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPointSize_Write1_IsErased.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPointSize_WriteViaCopyObjectPostAccessChainErased.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position.spvasm:main|Vertex: Fail
@@ -388,23 +388,23 @@ Assertion failed: glsl_get_components(type) == 4, file ../src/microsoft/compiler
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_BuiltIn_Position_Initializer.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePosition_PerVertexStructOutOfOrderDecl.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_OneAccessChain.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinPosition_StorePositionMember_TwoAccessChain.spvasm:main|Vertex: Fail
-Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3732
+Assertion failed: instr->deref_type == nir_deref_type_var || instr->deref_type == nir_deref_type_array, file ../src/microsoft/compiler/nir_to_dxil.c, line 3738
 
 
 Test:SpvModuleScopeVarParserTest_BuiltinVertexIndex.spvasm:main|Vertex: Fail
@@ -1501,4 +1501,4 @@ Test:SpvUnaryLogicalTest_LogicalNot_Vector.spvasm:main|Fragment: Pass
 Test:ValidIndex_SpvParserSwizzleTest_Sample_0.spvasm:main|Fragment: Pass
 Test:ValidIndex_SpvParserSwizzleTest_Sample_1.spvasm:main|Fragment: Pass
 Test:ValidIndex_SpvParserSwizzleTest_Sample_2.spvasm:main|Fragment: Pass
-Test:ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm:main|Fragment: Pass
\ No newline at end of file
+Test:ValidIndex_SpvParserSwizzleTest_Sample_3.spvasm:main|Fragment: Pass
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 9c9c18d8817..37afc451607 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