Skip to content

Commit

Permalink
[mono] MiniJIT OP_XEQUAL for floats (#77770)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
matouskozak and fanyang-mono authored Nov 11, 2022
1 parent ce0b82e commit 803fd02
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,6 @@ public void VectorSingleEqualsNaNTest()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/74781", TestRuntimes.Mono)]
public void VectorDoubleEqualsNonCanonicalNaNTest()
{
// max 8 bit exponent, just under half max mantissa
Expand All @@ -919,7 +918,6 @@ public void VectorDoubleEqualsNonCanonicalNaNTest()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/74781", TestRuntimes.Mono)]
public void VectorSingleEqualsNonCanonicalNaNTest()
{
// max 11 bit exponent, just under half max mantissa
Expand Down
10 changes: 9 additions & 1 deletion src/mono/mono/mini/mini-amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/mono/mono/mini/simd-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 803fd02

Please # to comment.