Skip to content

Commit 98b3a67

Browse files
tannergoodinggithub-actions
authored and
github-actions
committed
Adding a regression test for SixLabors/ImageSharp#2117
1 parent 393e1ab commit 98b3a67

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Runtime.Intrinsics;
5+
using System.Runtime.Intrinsics.X86;
6+
7+
public unsafe class ImageSharp_2117
8+
{
9+
public static int Main(string[] args)
10+
{
11+
if (Sse.IsSupported)
12+
{
13+
Vector128<float> fnan = Vector128.Create(float.NaN);
14+
Vector128<float> res1 = Sse.Max(Sse.LoadVector128((float*)(&fnan)), Vector128<float>.Zero);
15+
Vector128<float> res2 = Sse.Min(Sse.LoadVector128((float*)(&fnan)), Vector128<float>.Zero);
16+
17+
if (float.IsNaN(res1[0]) || float.IsNaN(res2[0]))
18+
{
19+
return 0;
20+
}
21+
}
22+
23+
if (Sse2.IsSupported)
24+
{
25+
Vector128<double> dnan = Vector128.Create(double.NaN);
26+
Vector128<double> res3 = Sse2.Max(Sse2.LoadVector128((double*)(&dnan)), Vector128<double>.Zero);
27+
Vector128<double> res4 = Sse2.Min(Sse2.LoadVector128((double*)(&dnan)), Vector128<double>.Zero);
28+
29+
if (double.IsNaN(res3[0]) || double.IsNaN(res4[0]))
30+
{
31+
return 0;
32+
}
33+
}
34+
35+
return 100;
36+
}
37+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
5+
</PropertyGroup>
6+
<PropertyGroup>
7+
<DebugType>None</DebugType>
8+
<Optimize>True</Optimize>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<Compile Include="$(MSBuildProjectName).cs" />
12+
</ItemGroup>
13+
</Project>

0 commit comments

Comments
 (0)