@@ -761,13 +761,10 @@ internal static void ByteToNormalizedFloatReduce(
761761 {
762762 DebugGuard . IsTrue ( source . Length == destination . Length , nameof ( source ) , "Input spans must be of same length!" ) ;
763763
764- if ( ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported ) ||
765- Avx2 . IsSupported ||
766- Sse2 . IsSupported ||
767- AdvSimd . IsSupported )
764+ if ( Vector128 . IsHardwareAccelerated )
768765 {
769766 int remainder ;
770- if ( Avx512F . IsSupported )
767+ if ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported )
771768 {
772769 remainder = Numerics . ModuloP2 ( source . Length , Vector512 < byte > . Count ) ;
773770 }
@@ -805,7 +802,7 @@ internal static unsafe void ByteToNormalizedFloat(
805802 ReadOnlySpan < byte > source ,
806803 Span < float > destination )
807804 {
808- if ( Avx512F . IsSupported )
805+ if ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported )
809806 {
810807 DebugVerifySpanInput ( source , destination , Vector512 < byte > . Count ) ;
811808
@@ -870,7 +867,7 @@ internal static unsafe void ByteToNormalizedFloat(
870867 Unsafe . Add ( ref d , 3 ) = f3;
871868 }
872869 }
873- else if ( Sse2 . IsSupported || AdvSimd . IsSupported )
870+ else if ( Vector128 . IsHardwareAccelerated )
874871 {
875872 DebugVerifySpanInput ( source , destination , Vector128 < byte > . Count ) ;
876873
@@ -897,7 +894,7 @@ internal static unsafe void ByteToNormalizedFloat(
897894 }
898895 else
899896 {
900- // Sse2, AdvSimd
897+ // Sse2, AdvSimd, etc
901898 Vector128 < byte > b = Vector128 . LoadUnsafe ( ref sourceBase , si ) ;
902899 ( Vector128 < ushort > s0 , Vector128 < ushort > s1 ) = Vector128 . Widen ( b ) ;
903900 ( i0 , i1 ) = Vector128 . Widen ( s0 . AsInt16 ( ) ) ;
@@ -931,13 +928,11 @@ internal static void NormalizedFloatToByteSaturateReduce(
931928 {
932929 DebugGuard . IsTrue ( source . Length == destination . Length , nameof ( source ) , "Input spans must be of same length!" ) ;
933930
934- if ( ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported ) ||
935- ( Vector256 . IsHardwareAccelerated && Avx2 . IsSupported ) ||
936- ( Vector128 . IsHardwareAccelerated && ( Sse2 . IsSupported || AdvSimd . IsSupported ) ) )
931+ if ( Sse2 . IsSupported || AdvSimd . IsSupported )
937932 {
938933 int remainder ;
939934
940- if ( Avx512BW . IsSupported )
935+ if ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported )
941936 {
942937 remainder = Numerics . ModuloP2 ( source . Length , Vector512 < byte > . Count ) ;
943938 }
@@ -977,7 +972,7 @@ internal static void NormalizedFloatToByteSaturate(
977972 ReadOnlySpan < float > source ,
978973 Span < byte > destination )
979974 {
980- if ( Avx512BW . IsSupported )
975+ if ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported )
981976 {
982977 DebugVerifySpanInput ( source , destination , Vector512 < byte > . Count ) ;
983978
@@ -1011,8 +1006,7 @@ internal static void NormalizedFloatToByteSaturate(
10111006 Unsafe . Add ( ref destinationBase , i ) = b;
10121007 }
10131008 }
1014- else
1015- if ( Avx2 . IsSupported )
1009+ else if ( Avx2 . IsSupported )
10161010 {
10171011 DebugVerifySpanInput ( source , destination , Vector256 < byte > . Count ) ;
10181012
@@ -1046,7 +1040,7 @@ internal static void NormalizedFloatToByteSaturate(
10461040 Unsafe . Add ( ref destinationBase , i ) = b;
10471041 }
10481042 }
1049- else
1043+ else if ( Sse2 . IsSupported || AdvSimd . IsSupported )
10501044 {
10511045 // Sse, AdvSimd
10521046 DebugVerifySpanInput ( source , destination , Vector128 < byte > . Count ) ;
0 commit comments