diff options
author | Matous Kozak <55735845+matouskozak@users.noreply.github.com> | 2022-11-11 19:14:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-11 19:14:10 +0300 |
commit | 803fd02979715a632c9d67b13c3218977dd3f5a9 (patch) | |
tree | 32df54d614d317fc42f6ae41c47f49c09dca60e8 | |
parent | ce0b82ea7a19957ad3796e7e9a92e393bf6e30cc (diff) |
[mono] MiniJIT OP_XEQUAL for floats (#77770)
* xequal special instruction for floats
* reduce code
* Moving type pass to emit_xequal
* OP_EXTRACT_MASK
* remove space
* Update src/mono/mono/mini/mini-amd64.c
* Update src/mono/mono/mini/mini-amd64.c
Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
-rw-r--r-- | src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs | 2 | ||||
-rw-r--r-- | src/mono/mono/mini/mini-amd64.c | 10 | ||||
-rw-r--r-- | src/mono/mono/mini/simd-intrinsics.c | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs b/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs index 543495857a1..207b7dc0e7b 100644 --- a/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs +++ b/src/libraries/System.Numerics.Vectors/tests/GenericVectorTests.cs @@ -894,7 +894,6 @@ namespace System.Numerics.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74781", TestRuntimes.Mono)] public void VectorDoubleEqualsNonCanonicalNaNTest() { // max 8 bit exponent, just under half max mantissa @@ -919,7 +918,6 @@ namespace System.Numerics.Tests } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74781", TestRuntimes.Mono)] public void VectorSingleEqualsNonCanonicalNaNTest() { // max 11 bit exponent, just under half max mantissa diff --git a/src/mono/mono/mini/mini-amd64.c b/src/mono/mono/mini/mini-amd64.c index bc4eedd8f86..bfede8ad36c 100644 --- a/src/mono/mono/mini/mini-amd64.c +++ b/src/mono/mono/mini/mini-amd64.c @@ -3882,8 +3882,16 @@ mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) case OP_XEQUAL: { int temp_reg1 = mono_alloc_ireg (cfg); int temp_reg2 = mono_alloc_ireg (cfg); + int opcode= -1; + switch (ins->inst_c1) + { + case MONO_TYPE_R4: opcode = OP_COMPPS; break; + case MONO_TYPE_R8: opcode = OP_COMPPD; break; + default: opcode = OP_PCMPEQD; + } - NEW_SIMD_INS (cfg, ins, temp, OP_PCMPEQD, temp_reg1, ins->sreg1, ins->sreg2); + NEW_SIMD_INS (cfg, ins, temp, opcode, temp_reg1, ins->sreg1, ins->sreg2); + temp->inst_c0 = 0; NEW_SIMD_INS (cfg, ins, temp, OP_EXTRACT_MASK, temp_reg2, temp_reg1, -1); temp->type = STACK_I4; NEW_INS (cfg, ins, temp, OP_COMPARE_IMM); diff --git a/src/mono/mono/mini/simd-intrinsics.c b/src/mono/mono/mini/simd-intrinsics.c index 42076ca77f9..5b52af08953 100644 --- a/src/mono/mono/mini/simd-intrinsics.c +++ b/src/mono/mono/mini/simd-intrinsics.c @@ -492,7 +492,10 @@ emit_xequal (MonoCompile *cfg, MonoClass *klass, MonoInst *arg1, MonoInst *arg2) else return emit_simd_ins (cfg, klass, OP_XEQUAL, arg1->dreg, arg2->dreg); #else - return emit_simd_ins (cfg, klass, OP_XEQUAL, arg1->dreg, arg2->dreg); + MonoInst *ins = emit_simd_ins (cfg, klass, OP_XEQUAL, arg1->dreg, arg2->dreg); + if (!COMPILE_LLVM (cfg)) + ins->inst_c1 = mono_class_get_context (klass)->class_inst->type_argv [0]->type; + return ins; #endif } |