diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj
index 50e6733592..12eeb1651a 100644
--- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj
+++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj
@@ -2,7 +2,7 @@
BenchmarkDotNet
- netstandard2.0;net6.0
+ netstandard2.0;net6.0;net8.0
true
$(NoWarn);1701;1702;1705;1591;3005;NU1702;CS3001;CS3003
BenchmarkDotNet
diff --git a/src/BenchmarkDotNet/Portability/Cpu/HardwareIntrinsics.cs b/src/BenchmarkDotNet/Portability/Cpu/HardwareIntrinsics.cs
index 68c48809b7..be1d40c9ec 100644
--- a/src/BenchmarkDotNet/Portability/Cpu/HardwareIntrinsics.cs
+++ b/src/BenchmarkDotNet/Portability/Cpu/HardwareIntrinsics.cs
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using BenchmarkDotNet.Environments;
-using System.Diagnostics.CodeAnalysis;
+using System.Text;
+
#if NET6_0_OR_GREATER
using System.Runtime.Intrinsics.X86;
using System.Runtime.Intrinsics.Arm;
@@ -16,6 +18,8 @@ internal static class HardwareIntrinsics
internal static string GetShortInfo()
{
+ if (IsX86Avx512FSupported)
+ return GetShortAvx512Representation();
if (IsX86Avx2Supported)
return "AVX2";
else if (IsX86AvxSupported)
@@ -52,7 +56,9 @@ static IEnumerable GetCurrentProcessInstructionSets(Platform platform)
{
case Platform.X86:
case Platform.X64:
- if (IsX86Avx2Supported) yield return "AVX2";
+
+ if (IsX86Avx512FSupported) yield return GetShortAvx512Representation();
+ else if (IsX86Avx2Supported) yield return "AVX2";
else if (IsX86AvxSupported) yield return "AVX";
else if (IsX86Sse42Supported) yield return "SSE4.2";
else if (IsX86Sse41Supported) yield return "SSE4.1";
@@ -90,6 +96,18 @@ static IEnumerable GetCurrentProcessInstructionSets(Platform platform)
}
}
+ private static string GetShortAvx512Representation()
+ {
+ StringBuilder avx512 = new ("AVX-512F");
+ if (IsX86Avx512CDSupported) avx512.Append("+CD");
+ if (IsX86Avx512BWSupported) avx512.Append("+BW");
+ if (IsX86Avx512DQSupported) avx512.Append("+DQ");
+ if (IsX86Avx512FVLSupported) avx512.Append("+VL");
+ if (IsX86Avx512VbmiSupported) avx512.Append("+VBMI");
+
+ return avx512.ToString();
+ }
+
internal static bool IsX86BaseSupported =>
#if NET6_0_OR_GREATER
X86Base.IsSupported;
@@ -153,6 +171,48 @@ static IEnumerable GetCurrentProcessInstructionSets(Platform platform)
GetIsSupported("System.Runtime.Intrinsics.X86.Avx2");
#endif
+ internal static bool IsX86Avx512FSupported =>
+#if NET8_0_OR_GREATER
+ Avx512F.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512F");
+#endif
+
+ internal static bool IsX86Avx512FVLSupported =>
+#if NET8_0_OR_GREATER
+ Avx512F.VL.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512F+VL");
+#endif
+
+ internal static bool IsX86Avx512BWSupported =>
+#if NET8_0_OR_GREATER
+ Avx512BW.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512BW");
+#endif
+
+ internal static bool IsX86Avx512CDSupported =>
+#if NET8_0_OR_GREATER
+ Avx512CD.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512CD");
+#endif
+
+ internal static bool IsX86Avx512DQSupported =>
+#if NET8_0_OR_GREATER
+ Avx512DQ.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512DQ");
+#endif
+
+ internal static bool IsX86Avx512VbmiSupported =>
+#if NET8_0_OR_GREATER
+ Avx512Vbmi.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.Avx512Vbmi");
+#endif
+
internal static bool IsX86AesSupported =>
#if NET6_0_OR_GREATER
System.Runtime.Intrinsics.X86.Aes.IsSupported;
@@ -211,8 +271,12 @@ static IEnumerable GetCurrentProcessInstructionSets(Platform platform)
GetIsSupported("System.Runtime.Intrinsics.X86.AvxVnni");
#endif
- // X86Serialize was introduced in .NET 7.0, BDN does not target it so we need to use reflection
- internal static bool IsX86SerializeSupported => GetIsSupported("System.Runtime.Intrinsics.X86.X86Serialize");
+ internal static bool IsX86SerializeSupported =>
+#if NET7_0_OR_GREATER
+ X86Serialize.IsSupported;
+#else
+ GetIsSupported("System.Runtime.Intrinsics.X86.X86Serialize");
+#endif
internal static bool IsArmBaseSupported =>
#if NET6_0_OR_GREATER
diff --git a/src/BenchmarkDotNet/Portability/Libc.cs b/src/BenchmarkDotNet/Portability/Libc.cs
index c9a3cf1322..036d7b584d 100644
--- a/src/BenchmarkDotNet/Portability/Libc.cs
+++ b/src/BenchmarkDotNet/Portability/Libc.cs
@@ -2,7 +2,9 @@
namespace BenchmarkDotNet.Portability
{
+#pragma warning disable CS8981 // The type name 'libc' only contains lower-cased ascii characters. Such names may become reserved for the language.
internal static class libc
+#pragma warning restore CS8981
{
[DllImport(nameof(libc))]
internal static extern int getppid();
diff --git a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs
index cc226de337..65eaceadfb 100644
--- a/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs
+++ b/src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs
@@ -161,7 +161,8 @@ private string GetILCompilerPackageReference()
private string GetTrimmingSettings()
=> rootAllApplicationAssemblies
- ? "" // use the defaults
+ // Use the defaults
+ ? ""
// TrimMode is set in explicit way as for older versions it might have different default value
: "linklink";
@@ -248,6 +249,11 @@ private IEnumerable GetCurrentProcessInstructionSets(Platform platform)
if (HardwareIntrinsics.IsX86Sse42Supported) yield return "sse4.2";
if (HardwareIntrinsics.IsX86AvxSupported) yield return "avx";
if (HardwareIntrinsics.IsX86Avx2Supported) yield return "avx2";
+ if (HardwareIntrinsics.IsX86Avx512FSupported) yield return "avx-512f";
+ if (HardwareIntrinsics.IsX86Avx512BWSupported) yield return "avx-512bw";
+ if (HardwareIntrinsics.IsX86Avx512CDSupported) yield return "avx-512cd";
+ if (HardwareIntrinsics.IsX86Avx512DQSupported) yield return "avx-512dq";
+ if (HardwareIntrinsics.IsX86Avx512VbmiSupported) yield return "avx-512vbmi";
if (HardwareIntrinsics.IsX86AesSupported) yield return "aes";
if (HardwareIntrinsics.IsX86Bmi1Supported) yield return "bmi";
if (HardwareIntrinsics.IsX86Bmi2Supported) yield return "bmi2";