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

Code before:
            return false;
        }

        case NI_System_Math_MultiplyAddEstimate:
        case NI_System_Math_ReciprocalEstimate:
            return true;

        default:
            return false;
    }

#elif defined(TARGET_WASM)

    // TODO-WASM-CQ: we can likely support more intrinsics here
    switch (intrinsicName)
    {
        case NI_System_Math_Abs:
        case NI_System_Math_Ceiling:
        case NI_System_Math_Floor:
        case NI_System_Math_Max:
        case NI_System_Math_Min:
        case NI_System_Math_Round:
        case NI_System_Math_Sqrt:
        case NI_System_Math_Truncate:
            return true;

        default:
            return false;
    }
#else
    // TODO: This portion of logic is not implemented for other arch.
    // The reason for returning true is that on all other arch the only intrinsic
    // enabled are target intrinsics.
    return true;
#endif
}

/******************************************************************************/
// Returns true if the given intrinsic will be implemented by calling System.Math
// methods.

bool Compiler::IsIntrinsicImplementedByUserCall(NamedIntrinsic intrinsicName)
{
    // Currently, if a math intrinsic is not implemented by target-specific
    // instructions, it will be implemented by a System.Math call. In the
    // future, if we turn to implementing some of them with helper calls,
    // this predicate needs to be revisited.
    return !IsTargetIntrinsic(intrinsicName);
}

bool Compiler::IsMathIntrinsic(NamedIntrinsic intrinsicName)

Review comment (suggestion):
For example:

```c++
case NI_System_Math_CopySign:         // f32.copysign / f64.copysign
case NI_System_Math_MaxNative:        // f32.max / f64.max
case NI_System_Math_MinNative:        // f32.min / f64.min
```

```c++
case PackIntrinsicAndType(NI_System_Math_CopySign, TYP_FLOAT):
    ins = INS_f32_copysign;
    break;
case PackIntrinsicAndType(NI_System_Math_CopySign, TYP_DOUBLE):
    ins = INS_f64_copysign;
    break;
```

Code after:

        default:
            return false;
    }
#elif defined(TARGET_LOONGARCH64)
    switch (intrinsicName)
    {
        case NI_System_Math_Abs:
        case NI_System_Math_Sqrt:
        case NI_System_Math_ReciprocalSqrtEstimate:
        {
            // TODO-LoongArch64: support these standard intrinsics
            return false;
        }

        case NI_System_Math_MultiplyAddEstimate:
        case NI_System_Math_ReciprocalEstimate:
            return true;

        default:
            return false;
    }

#elif defined(TARGET_WASM)

    // TODO-WASM-CQ: we can likely support more intrinsics here
    switch (intrinsicName)
    {
        case NI_System_Math_Abs:
        case NI_System_Math_Ceiling:
        case NI_System_Math_Floor:
        case NI_System_Math_Max:
        case NI_System_Math_MaxNative:
        case NI_System_Math_Min:
        case NI_System_Math_MinNative:
        case NI_System_Math_Round:
        case NI_System_Math_Sqrt:
        case NI_System_Math_Truncate:
            return true;

        case NI_PRIMITIVE_LeadingZeroCount:
        case NI_PRIMITIVE_TrailingZeroCount:
        case NI_PRIMITIVE_PopCount:
            return true;

        default:
            return false;
    }
#else
    // TODO: This portion of logic is not implemented for other arch.
    // The reason for returning true is that on all other arch the only intrinsic