<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)' == 'loongarch64'">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DefineConstants>$(DefineConstants);TARGET_LOONGARCH64</DefineConstants>
+ </PropertyGroup>
<!-- Configuration specific properties -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
"any",
"base"
],
+ "linux-loongarch64": [
+ "linux-loongarch64",
+ "linux",
+ "unix-loongarch64",
+ "unix",
+ "any",
+ "base"
+ ],
"linux-mips64": [
"linux-mips64",
"linux",
"any",
"base"
],
+ "unix-loongarch64": [
+ "unix-loongarch64",
+ "unix",
+ "any",
+ "base"
+ ],
"unix-mips64": [
"unix-mips64",
"unix",
"any",
"base"
]
-}
+}
\ No newline at end of file
"unix-armel"
]
},
+ "linux-loongarch64": {
+ "#import": [
+ "linux",
+ "unix-loongarch64"
+ ]
+ },
"linux-mips64": {
"#import": [
"linux",
"unix"
]
},
+ "unix-loongarch64": {
+ "#import": [
+ "unix"
+ ]
+ },
"unix-mips64": {
"#import": [
"unix"
]
}
}
-}
+}
\ No newline at end of file
<ItemGroup>
<RuntimeGroup Include="unix">
<Parent>any</Parent>
- <Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
+ <Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
</RuntimeGroup>
<RuntimeGroup Include="linux">
<Parent>unix</Parent>
- <Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
+ <Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
</RuntimeGroup>
<RuntimeGroup Include="linux-musl">
<Parent>linux</Parent>
internal static class PaddingHelpers
{
/// <summary>A size greater than or equal to the size of the most common CPU cache lines.</summary>
-#if TARGET_ARM64
+#if TARGET_ARM64 || TARGET_LOONGARCH64
internal const int CACHE_LINE_SIZE = 128;
#else
internal const int CACHE_LINE_SIZE = 64;
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or ('$(Platform)' == 'x86' and '$(TargetsUnix)' != 'true')">true</SupportsX86Intrinsics>
<ILLinkSharedDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkSharedDirectory>
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian>
- <Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x'">true</Is64Bit>
+ <Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x' or '$(Platform)' == 'loongarch64'">true</Is64Bit>
<UseMinimalGlobalizationData Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsBrowser)' == 'true'">true</UseMinimalGlobalizationData>
</PropertyGroup>
<PropertyGroup>
{
public static partial class Buffer
{
-#if TARGET_ARM64
+#if TARGET_ARM64 || TARGET_LOONGARCH64
// Managed code is currently faster than glibc unoptimized memmove
// TODO-ARM64-UNIX-OPT revisit when glibc optimized memmove is in Linux distros
// https://github.com/dotnet/runtime/issues/8897
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM)
+#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM) || TARGET_LOONGARCH64
#define HAS_CUSTOM_BLOCKS
#endif
Arm,
Arm64,
Wasm,
- S390x
+ S390x,
+ LoongArch64
}
}
=> Architecture.Wasm;
#elif TARGET_S390X
=> Architecture.S390x;
+#elif TARGET_LOONGARCH64
+ => Architecture.LoongArch64;
#else
#error Unknown Architecture
#endif
if (byteLength == 0)
return;
-#if TARGET_AMD64 || TARGET_ARM64
+#if TARGET_AMD64 || TARGET_ARM64 || TARGET_LOONGARCH64
// The exact matrix on when ZeroMemory is faster than InitBlockUnaligned is very complex. The factors to consider include
// type of hardware and memory alignment. This threshold was chosen as a good balance across different configurations.
if (byteLength > 768)
private static class WorkerThread
{
private const int SemaphoreSpinCountDefaultBaseline = 70;
-#if !TARGET_ARM64 && !TARGET_ARM
+#if !TARGET_ARM64 && !TARGET_ARM && !TARGET_LOONGARCH64
private const int SemaphoreSpinCountDefault = SemaphoreSpinCountDefaultBaseline;
#else
// On systems with ARM processors, more spin-waiting seems to be necessary to avoid perf regressions from incurring
Amd64 = (ushort)34404,
M32R = (ushort)36929,
Arm64 = (ushort)43620,
+ LoongArch32 = (ushort)25138,
+ LoongArch64 = (ushort)25188,
}
public partial class ManagedPEBuilder : System.Reflection.PortableExecutable.PEBuilder
{
/// ARM64
/// </summary>
Arm64 = 0xAA64,
+
+ /// <summary>
+ /// LOONGARCH32
+ /// </summary>
+ LoongArch32 = 0x6232,
+
+ /// <summary>
+ /// LOONGARCH64
+ /// </summary>
+ LoongArch64 = 0x6264,
}
}
Assert.Equal(Architecture.S390x, processArch);
break;
+ case Architecture.LoongArch64:
+ Assert.Equal(Architecture.LoongArch64, processArch);
+ break;
+
default:
Assert.False(true, "Unexpected Architecture.");
break;
Arm64 = 3,
Wasm = 4,
S390x = 5,
+ LoongArch64 = 6,
}
public enum CharSet
{
#if defined(TARGET_ARM64)
#define TARGET_CPU_TYPE CPU_TYPE_ARM64
+#elif defined(TARGET_LOONGARCH64)
+#define TARGET_CPU_TYPE CPU_TYPE_LOONGARCH64
#else
#define TARGET_CPU_TYPE CPU_TYPE_X86_64
#endif
return _X("arm");
#elif defined(TARGET_ARM64)
return _X("arm64");
+#elif defined(TARGET_LOONGARCH64)
+ return _X("loongarch64");
#elif defined(TARGET_S390X)
return _X("s390x");
#else
const ep_char8_t* _ep_arch_info = "arm64";
#elif defined(TARGET_S390X)
const ep_char8_t* _ep_arch_info = "s390x";
+#elif defined(TARGET_LOONGARCH64)
+const ep_char8_t* _ep_arch_info = "loongarch64";
#else
const ep_char8_t* _ep_arch_info = "Unknown";
#endif
ARCH_ARM,
ARCH_ARM64,
ARCH_WASM,
- ARCH_S390X
+ ARCH_S390X,
+ ARCH_LOONGARCH64
};