forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that the Create(Dot(...)) optimization doesn't kick in for Vec…
…tor2 pre SSE4.1 (dotnet#96951) * Ensure that the Create(Dot(...)) optimization doesn't kick in for Vector2 pre SSE4.1 * Make sure to use #if defined(...) * Add missing using * Fix a type in the test
- Loading branch information
1 parent
80f1ed6
commit 1535f3d
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/tests/JIT/Regression/JitBlue/Runtime_96939/Runtime_96939.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Numerics; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.Intrinsics; | ||
using Xunit; | ||
|
||
public static class Runtime_96939 | ||
{ | ||
[Fact] | ||
[MethodImpl(MethodImplOptions.AggressiveOptimization)] | ||
public static void Problem() | ||
{ | ||
Assert.Equal(new Vector2(13), TestVector2(new Vector2(2, 3))); | ||
Assert.Equal(new Vector3(29), TestVector3(new Vector3(2, 3, 4))); | ||
Assert.Equal(new Vector4(54), TestVector4(new Vector4(2, 3, 4, 5))); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
public static Vector2 TestVector2(Vector2 value) | ||
{ | ||
return Vector2.Dot(value, value) * new Vector2(1, 1); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
public static Vector3 TestVector3(Vector3 value) | ||
{ | ||
return Vector3.Dot(value, value) * new Vector3(1, 1, 1); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)] | ||
public static Vector4 TestVector4(Vector4 value) | ||
{ | ||
return Vector4.Dot(value, value) * new Vector4(1, 1, 1, 1); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/tests/JIT/Regression/JitBlue/Runtime_96939/Runtime_96939.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
<DebugType>None</DebugType> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |