Skip to content

Commit 43eaf48

Browse files
committed
Add support for LoongArch64.
1 parent 9c1c27b commit 43eaf48

File tree

8 files changed

+18
-7
lines changed

8 files changed

+18
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json
110110
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT
111111
*Supported languages:* C#, F#, Visual Basic
112112
*Supported OS:* Windows, Linux, macOS
113-
*Supported architectures:* x86, x64, ARM, ARM64 and Wasm
113+
*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64
114114

115115
## Features
116116

docs/articles/guides/console-args.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ dotnet run -c Release -- --filter * --runtimes netcoreapp2.0 netcoreapp2.1 --sta
218218
* `--maxWidth` max parameter column width, the default is 20.
219219
* `--envVars` colon separated environment variables (key:value).
220220
* `--strategy` the RunStrategy that should be used. Throughput/ColdStart/Monitoring.
221-
* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64.
221+
* `--platform` the Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64.
222222
* `--runOncePerIteration` run the benchmark exactly once per iteration.
223223
* `--buildTimeout` build timeout in seconds.
224224
* `--wasmEngine` full path to a java script engine used to run the benchmarks, used by Wasm toolchain.

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ The measured data can be exported to different formats (md, html, csv, xml, json
111111
*Supported runtimes:* .NET 5+, .NET Framework 4.6.1+, .NET Core 2.0+, Mono, NativeAOT
112112
*Supported languages:* C#, F#, Visual Basic
113113
*Supported OS:* Windows, Linux, macOS
114-
*Supported architectures:* x86, x64, ARM, ARM64 and Wasm
114+
*Supported architectures:* x86, x64, ARM, ARM64, Wasm and LoongArch64
115115

116116
## Features
117117

src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public class CommandLineOptions
133133
[Option("strategy", Required = false, HelpText = "The RunStrategy that should be used. Throughput/ColdStart/Monitoring.")]
134134
public RunStrategy? RunStrategy { get; set; }
135135

136-
[Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64.")]
136+
[Option("platform", Required = false, HelpText = "The Platform that should be used. If not specified, the host process platform is used (default). AnyCpu/X86/X64/Arm/Arm64/LoongArch64.")]
137137
public Platform? Platform { get; set; }
138138

139139
[Option("runOncePerIteration", Required = false, Default = false, HelpText = "Run the benchmark exactly once per iteration.")]

src/BenchmarkDotNet/Environments/Platform.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public enum Platform
3535
/// <summary>
3636
/// S390x
3737
/// </summary>
38-
S390x
38+
S390x,
39+
40+
/// <summary>
41+
/// LOONGARCH64
42+
/// </summary>
43+
LoongArch64
3944
}
40-
}
45+
}

src/BenchmarkDotNet/Extensions/ConfigurationExtensions.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ public static string ToConfig(this Platform platform)
2222
return "ARM64";
2323
case Platform.S390x:
2424
return "S390x";
25+
case Platform.LoongArch64:
26+
return "LOONGARCH64";
2527
default:
2628
return "AnyCPU";
2729
}
2830
}
2931

3032
public static string ToConfig(this Jit jit) => jit == Jit.LegacyJit ? "1" : "0";
3133
}
32-
}
34+
}

src/BenchmarkDotNet/Portability/RuntimeInformation.cs

+3
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ public static Platform GetCurrentPlatform()
234234
// https://github.com/dotnet/runtime/blob/d81ad044fa6830f5f31f6b6e8224ebf66a3c298c/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/Architecture.cs#L12-L13
235235
const Architecture Wasm = (Architecture)4;
236236
const Architecture S390x = (Architecture)5;
237+
const Architecture LoongArch64 = (Architecture)6;
237238

238239
switch (ProcessArchitecture)
239240
{
@@ -249,6 +250,8 @@ public static Platform GetCurrentPlatform()
249250
return Platform.Wasm;
250251
case S390x:
251252
return Platform.S390x;
253+
case LoongArch64:
254+
return Platform.LoongArch64;
252255
default:
253256
throw new ArgumentOutOfRangeException();
254257
}

tests/BenchmarkDotNet.Tests/ConfigParserTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ public void UserCanSpecifyEnvironmentVariables()
476476
[InlineData(Platform.X64)]
477477
[InlineData(Platform.Arm)]
478478
[InlineData(Platform.Arm64)]
479+
[InlineData(Platform.LoongArch64)]
479480
public void UserCanSpecifyProcessPlatform(Platform platform)
480481
{
481482
var parsedConfig = ConfigParser.Parse(new[] { "--platform", platform.ToString() }, new OutputLogger(Output)).config;

0 commit comments

Comments
 (0)