Skip to content

Commit

Permalink
Optimize some Matrix4x4 operations with SSE (dotnet/corefx#31779)
Browse files Browse the repository at this point in the history
* Optimize some Matrix4x4 operations with SSE

* fix typo

* use SetZeroVector128 instead of SetAllVector128(0.0f)

* [StructLayout(LayoutKind.Sequential)] on top of Matrix4x4

* collapse operators (call corresponding methods)

* mark operators with [MethodImpl(MethodImplOptions.AggressiveInlining)]

* remove [MethodImpl(MethodImplOptions.AggressiveInlining)], call operators inside static methods if SSE is enabled (operators should be small enough to be inlined)

* overwrite value1 in Multiply instead of new instance

* Optimize == and !=

* prefer CompareNotEqual than CompareEqual

* fix typo in == and !=

* clean up methods-operators

* optimize Transpose

* simplify Equals

* improve Transpose

* Lerp as a separate method

* remove SSE from != as it fails some NaN-related tests

* remove unsafe from !=

* wrap intrinsics with #if netcoreapp

* forgot Letp method and usings

* define netcoreapp in csproj

* rename netcoreapp symbol to HAS_INTRINSICS

* Move Equal and Lerp to VectorMath.cs internal helper

* Implement != operator

* Debug.Assert(Sse.IsSupported) in VectorMath

* replace SetAllVector with Shuffle in Multiply

* remove #if HAS_INTRINSICS from VectorMath

* fix indention in System.Numerics.Vectors.csproj


Commit migrated from dotnet/corefx@5ab0d37
  • Loading branch information
EgorBo authored and eerhardt committed Aug 17, 2018
1 parent d5080c9 commit e30b3ae
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<IsTargetingNetFx Condition="'$(TargetGroup)'=='netfx' OR '$(TargetGroup)'=='net46'">true</IsTargetingNetFx>
<IsTargetingNetCoreApp Condition="'$(TargetGroup)'=='netcoreapp' OR '$(TargetGroup)'=='uap' OR '$(TargetGroup)'=='uapaot'">true</IsTargetingNetCoreApp>
<IsPartialFacadeAssembly Condition="'$(IsTargetingNetFx)'=='true' OR '$(IsTargetingNetCoreApp)'=='true'">true</IsPartialFacadeAssembly>
<HasIntrinsics Condition="'$(TargetsNetCoreApp)'=='true'">true</HasIntrinsics>
<DefineConstants Condition="'$(HasIntrinsics)'=='true'">$(DefineConstants);HAS_INTRINSICS</DefineConstants>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.0'">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
<Configurations>net46-Debug;net46-Release;netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard1.0-Debug;netstandard1.0-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release;uapaot-Windows_NT-Debug;uapaot-Windows_NT-Release</Configurations>
</PropertyGroup>
Expand Down Expand Up @@ -62,6 +64,9 @@
<Compile Include="System\Numerics\Vector4.cs" />
<Compile Include="System\Numerics\Vector4_Intrinsics.cs" />
</ItemGroup>
<ItemGroup Condition="'$(HasIntrinsics)' == 'true'">
<Compile Include="System\Numerics\VectorMath.cs" />
</ItemGroup>
<ItemGroup Condition="'$(IsTargetingNetFx)' == 'true'">
<Reference Include="mscorlib" />
<Reference Include="System.Numerics" />
Expand Down
Loading

0 comments on commit e30b3ae

Please sign in to comment.