File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/libraries/System.Private.CoreLib/src/System/Text Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -536,8 +536,19 @@ public static Vector256<ushort> Load256(ref byte ptr)
536536 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
537537 public static Vector512 < ushort > Load512 ( ref byte ptr )
538538 {
539- ( Vector256 < ushort > lower , Vector256 < ushort > upper ) = Vector256 . Widen ( Vector256 . LoadUnsafe ( ref ptr ) ) ;
540- return Vector512 . Create ( lower , upper ) ;
539+ // This is done here for performance gain.
540+ // A similar implementation would be as below:
541+ //
542+ // (Vector256<ushort> lower, Vector256<ushort> upper) = Vector256.Widen(Vector256.LoadUnsafe(ref ptr));
543+ // return Vector512.Create(lower, upper);
544+ //
545+ // This is similar to what is done for Load256 here. But
546+ // for Vector512, this implementation is low performance
547+ // since a load and widen on Vector256 followed by a
548+ // create on Vector512 is leading to a performance lower
549+ // than that of similar implementationfor Vector256.
550+ ( Vector512 < ushort > lower , Vector512 < ushort > _ ) = Vector512 . Widen ( Vector256 . LoadUnsafe ( ref ptr ) . ToVector512 ( ) ) ;
551+ return lower ;
541552 }
542553
543554 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
You can’t perform that action at this time.
0 commit comments