File tree 2 files changed +2
-5
lines changed
System.Private.CoreLib/src/System/Numerics
System.Utf8String.Experimental/src/System/Runtime/Intrinsics
2 files changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -241,11 +241,7 @@ public static int PopCount(uint value)
241
241
{
242
242
// PopCount works on vector so convert input value to vector first.
243
243
244
- // Vector64.CreateScalar(uint) generates suboptimal code by storing and
245
- // loading the result to memory.
246
- // See https://github.com/dotnet/runtime/issues/35976 for details.
247
- // Hence use Vector64.Create(ulong) to create Vector64<ulong> and operate on that.
248
- Vector64 < ulong > input = Vector64 . Create ( ( ulong ) value ) ;
244
+ Vector64 < uint > input = Vector64 . CreateScalar ( value ) ;
249
245
Vector64 < byte > aggregated = AdvSimd . Arm64 . AddAcross ( AdvSimd . PopCount ( input . AsByte ( ) ) ) ;
250
246
return aggregated . ToScalar ( ) ;
251
247
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ namespace System.Runtime.Intrinsics
7
7
internal static class Vector64
8
8
{
9
9
public static Vector64 < ulong > Create ( ulong value ) => throw new PlatformNotSupportedException ( ) ;
10
+ public static Vector64 < uint > CreateScalar ( uint value ) => throw new PlatformNotSupportedException ( ) ;
10
11
public static Vector64 < byte > AsByte < T > ( this Vector64 < T > vector ) where T : struct => throw new PlatformNotSupportedException ( ) ;
11
12
}
12
13
internal readonly struct Vector64 < T >
You can’t perform that action at this time.
0 commit comments