@@ -11699,6 +11699,37 @@ NamedIntrinsic Compiler::resolveNamedIntrinsic(CORINFO_METHOD_HANDLE method, Nam
1169911699
1170011700 if (isSupportQuery)
1170111701 {
11702+ #if defined(TARGET_LOONGARCH64)
11703+ const char* className = nullptr;
11704+ const char* namespaceName = nullptr;
11705+ const char* enclosingClassNames[2] = {nullptr};
11706+ info.compCompHnd->getMethodNameFromMetadata(method, &className, &namespaceName, enclosingClassNames,
11707+ ArrLen(enclosingClassNames));
11708+ if ((strncmp(className, "BH", 2) == 0) && opts.compSupportsISA.HasInstructionSet(InstructionSet_LAM_BH))
11709+ {
11710+ if (!IsTargetAbi(CORINFO_NATIVEAOT_ABI) || compExactlyDependsOn(InstructionSet_LAM_BH))
11711+ {
11712+ result = NI_IsSupported_True;
11713+ }
11714+ else
11715+ {
11716+ assert(IsTargetAbi(CORINFO_NATIVEAOT_ABI));
11717+ result = NI_IsSupported_Dynamic;
11718+ }
11719+ }
11720+ if ((strncmp(className, "CAS", 3) == 0) && opts.compSupportsISA.HasInstructionSet(InstructionSet_LAM_CAS))
11721+ {
11722+ if (!IsTargetAbi(CORINFO_NATIVEAOT_ABI) || compExactlyDependsOn(InstructionSet_LAM_CAS))
11723+ {
11724+ result = NI_IsSupported_True;
11725+ }
11726+ else
11727+ {
11728+ assert(IsTargetAbi(CORINFO_NATIVEAOT_ABI));
11729+ result = NI_IsSupported_Dynamic;
11730+ }
11731+ }
11732+ #endif
1170211733 return (result == NI_Illegal) ? NI_IsSupported_False : result;
1170311734 }
1170411735
@@ -12660,36 +12691,6 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
1266012691
1266112692 result = NI_IsSupported_Type;
1266212693 }
12663- #if defined(TARGET_LOONGARCH64)
12664- else if ((strncmp(className, "BH", 2) == 0) &&
12665- opts.compSupportsISA.HasInstructionSet(InstructionSet_LAM_BH))
12666- {
12667- if (!IsTargetAbi(CORINFO_NATIVEAOT_ABI) ||
12668- compExactlyDependsOn(InstructionSet_LAM_BH))
12669- {
12670- result = NI_IsSupported_True;
12671- }
12672- else
12673- {
12674- assert(IsTargetAbi(CORINFO_NATIVEAOT_ABI));
12675- result = NI_IsSupported_Dynamic;
12676- }
12677- }
12678- else if ((strncmp(className, "CAS", 3) == 0) &&
12679- opts.compSupportsISA.HasInstructionSet(InstructionSet_LAM_CAS))
12680- {
12681- if (!IsTargetAbi(CORINFO_NATIVEAOT_ABI) ||
12682- compExactlyDependsOn(InstructionSet_LAM_CAS))
12683- {
12684- result = NI_IsSupported_True;
12685- }
12686- else
12687- {
12688- assert(IsTargetAbi(CORINFO_NATIVEAOT_ABI));
12689- result = NI_IsSupported_Dynamic;
12690- }
12691- }
12692- #endif
1269312694 else
1269412695 {
1269512696 result = NI_IsSupported;
0 commit comments