Repository: dotnet/runtime
File: src/coreclr/jit/codegenwasm.cpp (C++)

Code before:
    {
        // We don't expect to see GT_EQ unordered,
        // since CIL doesn't have this mode.
        //
        assert(op != GT_EQ);

        // Wasm float comparisons other than "fne" return false for NaNs.
        // Our unordered float compares need to return true for NaNs.
        //
        // So we can re-express say GT_GE (UN) as !GT_LT
        //
        if (op != GT_NE)
        {
            op          = GenTree::ReverseRelop(op);
            invertSense = true;
        }
    }
    else
    {
        // We don't expect to see GT_NE ordered,
        // since CIL doesn't have this mode.
        //
        assert(op != GT_NE);
    }

    genConsumeOperands(treeNode);

    instruction ins;
    switch (PackOperAndType(op, treeNode->gtOp1->TypeGet()))
    {
        case PackOperAndType(GT_EQ, TYP_FLOAT):
            ins = INS_f32_eq;
            break;
        case PackOperAndType(GT_EQ, TYP_DOUBLE):
            ins = INS_f64_eq;
            break;
        case PackOperAndType(GT_NE, TYP_FLOAT):
            ins = INS_f32_ne;
            break;
        case PackOperAndType(GT_NE, TYP_DOUBLE):
            ins = INS_f64_ne;
            break;
        case PackOperAndType(GT_LT, TYP_FLOAT):
            ins = INS_f32_lt;
            break;
        case PackOperAndType(GT_LT, TYP_DOUBLE):
            ins = INS_f64_lt;
            break;
        case PackOperAndType(GT_LE, TYP_FLOAT):
            ins = INS_f32_le;
            break;

Review comment (refactor):
The error message could be clearer. Consider rephrasing to: 'Static helper calls without indirection cells not yet implemented'.
```suggestion
                NYI_WASM("Static helper calls without indirection cells not yet implemented");
```

Code after:
        // CORINFO_HELP_DISPATCH_INDIRECT_CALL in which case we still have the
        // indirection cell but we should not try to optimize.
        WellKnownArg indirectionCellArgKind = WellKnownArg::None;
        if (!call->IsHelperCall(compiler, CORINFO_HELP_DISPATCH_INDIRECT_CALL))
        {
            indirectionCellArgKind = call->GetIndirectionCellArgKind();
        }

        if (indirectionCellArgKind != WellKnownArg::None)
        {
            assert(call->IsR2ROrVirtualStubRelativeIndir());

            params.callType = EC_INDIR_R;
            // params.ireg     = targetAddrReg;
            genEmitCallWithCurrentGC(params);
        }
        else
        {
            // Generate a direct call to a non-virtual user defined or helper method
            assert(call->IsHelperCall() || (call->gtCallType == CT_USER_FUNC));

            assert(call->gtEntryPoint.addr == NULL);

            if (call->IsHelperCall())
            {
                NYI_WASM("Call helper statically without indirection cell");
                CorInfoHelpFunc helperNum = compiler->eeGetHelperNum(params.methHnd);
                noway_assert(helperNum != CORINFO_HELP_UNDEF);

                CORINFO_CONST_LOOKUP helperLookup = compiler->compGetHelperFtn(helperNum);
                params.addr                       = helperLookup.addr;
                assert(helperLookup.accessType == IAT_VALUE);
            }
            else
            {
                // Direct call to a non-virtual user function.
                params.addr = call->gtDirectCallAddress;
            }

            params.callType = EC_FUNC_TOKEN;
            genEmitCallWithCurrentGC(params);
        }
    }
}

/*****************************************************************************
 *  Emit a call to a helper function.
 */
void CodeGen::genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize, regNumber callTargetReg /*= REG_NA */)
{
    EmitCallParams params;