@@ -334,7 +334,7 @@ public PathSegmentIterator() =>
334334
335335 while ( ( int ) _position < length )
336336 {
337- if ( ( Avx2 . IsSupported || Sse2 . IsSupported || AdvSimd . IsSupported ) && _mask != 0 )
337+ if ( ( Avx2 . IsSupported || Sse2 . IsSupported || AdvSimd . Arm64 . IsSupported ) && _mask != 0 )
338338 {
339339 var offset = BitOperations . TrailingZeroCount ( _mask ) ;
340340 if ( AdvSimd . IsSupported )
@@ -446,8 +446,7 @@ public PathSegmentIterator() =>
446446 if ( _mask == 0 )
447447 _position += Vector128 < ushort > . Count ;
448448 }
449- #if NET7_0_OR_GREATER
450- else if ( AdvSimd . IsSupported && ( int ) _position + Vector128 < ushort > . Count <= length )
449+ else if ( AdvSimd . Arm64 . IsSupported && ( int ) _position + Vector128 < ushort > . Count <= length )
451450 {
452451 var chunk = LoadVector128 ( ref source , _position ) ;
453452 var backslashMask = CreateBackslash128Bitmask ( flags ) ;
@@ -466,15 +465,24 @@ public PathSegmentIterator() =>
466465 // This avoids reloading SIMD registers and repeating comparisons
467466 // on the same chunk of data.
468467 //
469- _mask = comparison . ExtractMostSignificantBits( ) ;
468+ _mask = ExtractMostSignificantBits ( comparison ) ;
470469
471470 //
472471 // Advance position to the next chunk when no separators found
473472 //
474473 if ( _mask == 0 )
475474 _position += Vector128 < ushort > . Count ;
475+
476+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
477+ static uint ExtractMostSignificantBits ( Vector128 < ushort > v )
478+ {
479+ var sum = AdvSimd . Arm64 . AddAcross (
480+ AdvSimd . ShiftLogical (
481+ AdvSimd . And ( v , Vector128 . Create ( ( ushort ) 0x8000 ) ) ,
482+ Vector128 . Create ( ( short ) - 15 , - 14 , - 13 , - 12 , - 11 , - 10 , - 9 , - 8 ) ) ) ;
483+ return sum . ToScalar ( ) ;
484+ }
476485 }
477- #endif
478486 else
479487 {
480488 for ( ; ( int ) _position < length ; _position ++ )
0 commit comments