- Notifications
You must be signed in to change notification settings - Fork5.2k
Accelerate Vector128<long>::op_Multiply on x64#103555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
21 commits Select commitHold shift + click to select a range
ae17211 Accelerate Vector128 mul for long/ulong
EgorBoafda312 better ulong version
EgorBoab01574 fix build
EgorBo21b42de Update Vector128_1.cs
EgorBo581f1e2 Sse41 version
EgorBo49a359f Update src/libraries/System.Private.CoreLib/src/System/Runtime/Intrin…
EgorBo57898f0 Update Vector128_1.cs
EgorBof1be705 Update Vector128_1.cs
EgorBo95d0eb8 Update Vector128_1.cs
EgorBodcfd93d Update Vector128_1.cs
EgorBo7fec9e3 Update Vector128_1.cs
EgorBoe172296 Update Vector128_1.cs
EgorBo0456d12 Update Vector128_1.cs
EgorBo8af6104 Merge branch 'main' of https://github.com/dotnet/runtime into arm-mul…
EgorBo69572a2 Update Vector128_1.cs
EgorBod607549 clean up
EgorBo573a37b move to jit
EgorBo3790d1b clean up
EgorBo60441f3 revert unrelated changes
EgorBo5b78ddd Merge branch 'main' of https://github.com/dotnet/runtime into arm-mul…
EgorBocc257dd Address feedback
EgorBoFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
Accelerate Vector128 mul for long/ulong
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commitae17211ef2ac4e4c60f20c4c70bc42e654b86869
There are no files selected for viewing
33 changes: 32 additions & 1 deletionsrc/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128_1.cs
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| using System.Diagnostics; | ||
| @@ -7,6 +7,7 @@ | ||
| using System.Numerics; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
| using System.Runtime.Intrinsics.Arm; | ||
| using System.Text; | ||
| namespace System.Runtime.Intrinsics | ||
| @@ -261,6 +262,36 @@ public static Vector128<T> Zero | ||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| public static Vector128<T> operator *(Vector128<T> left, Vector128<T> right) | ||
| { | ||
| // TODO: ShiftLeftLogical has invalid [ConstantExpected] attribute on it | ||
| #pragma warning disable CA1857 | ||
| // TODO: move this to JIT | ||
| if (AdvSimd.IsSupported && typeof(T) == typeof(long)) | ||
| { | ||
| Vector128<long> a = left.AsInt64(); | ||
| Vector128<long> b = left.AsInt64(); | ||
| return AdvSimd.MultiplyWideningLowerAndAdd( | ||
| AdvSimd.ShiftLeftLogical( | ||
| AdvSimd.AddPairwiseWidening( | ||
| AdvSimd.Multiply(b.AsInt32(), | ||
| AdvSimd.ReverseElement32(a).AsInt32()).AsUInt32()).AsInt64(), 32), | ||
| AdvSimd.ExtractNarrowingLower(a), | ||
| AdvSimd.ExtractNarrowingLower(b)).As<long, T>(); | ||
| } | ||
| if (AdvSimd.IsSupported && typeof(T) == typeof(ulong)) | ||
| { | ||
| Vector128<ulong> a = left.AsUInt64(); | ||
| Vector128<ulong> b = left.AsUInt64(); | ||
EgorBo marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return AdvSimd.MultiplyWideningLowerAndAdd( | ||
| AdvSimd.ShiftLeftLogical( | ||
| AdvSimd.AddPairwiseWidening( | ||
| AdvSimd.Multiply(b.AsUInt32(), | ||
| AdvSimd.ReverseElement32(a).AsUInt32()).AsUInt32()).AsUInt64(), 32), | ||
| AdvSimd.ExtractNarrowingLower(a), | ||
| AdvSimd.ExtractNarrowingLower(b)).As<ulong, T>(); | ||
| } | ||
| #pragma warning restore CA1857 | ||
| return Vector128.Create( | ||
| left._lower * right._lower, | ||
| left._upper * right._upper | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.