-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimdConfigurationTests.cs
More file actions
29 lines (26 loc) · 989 Bytes
/
SimdConfigurationTests.cs
File metadata and controls
29 lines (26 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
namespace Ramstack.Globbing;
[TestFixture]
public class SimdConfigurationTests
{
[Test]
public void VerifySimdConfiguration()
{
if (Environment.GetEnvironmentVariable("DOTNET_EnableHWIntrinsic") == "0")
{
Assert.That(Sse2.IsSupported, Is.False);
Assert.That(Sse41.IsSupported, Is.False);
Assert.That(Avx2.IsSupported, Is.False);
Assert.That(AdvSimd.Arm64.IsSupported, Is.False);
Assert.That(AdvSimd.IsSupported, Is.False);
}
if (RuntimeInformation.ProcessArchitecture == Architecture.X64 && Environment.GetEnvironmentVariable("DOTNET_EnableAVX2") == "0")
{
Assert.That(Sse2.IsSupported, Is.True);
Assert.That(Sse41.IsSupported, Is.True);
Assert.That(Avx2.IsSupported, Is.False);
}
}
}