@@ -761,13 +761,10 @@ internal static void ByteToNormalizedFloatReduce(
761
761
{
762
762
DebugGuard . IsTrue ( source . Length == destination . Length , nameof ( source ) , "Input spans must be of same length!" ) ;
763
763
764
- if ( ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported ) ||
765
- Avx2 . IsSupported ||
766
- Sse2 . IsSupported ||
767
- AdvSimd . IsSupported )
764
+ if ( Vector128 . IsHardwareAccelerated )
768
765
{
769
766
int remainder ;
770
- if ( Avx512F . IsSupported )
767
+ if ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported )
771
768
{
772
769
remainder = Numerics . ModuloP2 ( source . Length , Vector512 < byte > . Count ) ;
773
770
}
@@ -805,7 +802,7 @@ internal static unsafe void ByteToNormalizedFloat(
805
802
ReadOnlySpan < byte > source ,
806
803
Span < float > destination )
807
804
{
808
- if ( Avx512F . IsSupported )
805
+ if ( Vector512 . IsHardwareAccelerated && Avx512F . IsSupported )
809
806
{
810
807
DebugVerifySpanInput ( source , destination , Vector512 < byte > . Count ) ;
811
808
@@ -870,7 +867,7 @@ internal static unsafe void ByteToNormalizedFloat(
870
867
Unsafe . Add ( ref d , 3 ) = f3;
871
868
}
872
869
}
873
- else if ( Sse2 . IsSupported || AdvSimd . IsSupported )
870
+ else if ( Vector128 . IsHardwareAccelerated )
874
871
{
875
872
DebugVerifySpanInput ( source , destination , Vector128 < byte > . Count ) ;
876
873
@@ -897,7 +894,7 @@ internal static unsafe void ByteToNormalizedFloat(
897
894
}
898
895
else
899
896
{
900
- // Sse2, AdvSimd
897
+ // Sse2, AdvSimd, etc
901
898
Vector128 < byte > b = Vector128 . LoadUnsafe ( ref sourceBase , si ) ;
902
899
( Vector128 < ushort > s0 , Vector128 < ushort > s1 ) = Vector128 . Widen ( b ) ;
903
900
( i0 , i1 ) = Vector128 . Widen ( s0 . AsInt16 ( ) ) ;
@@ -931,13 +928,11 @@ internal static void NormalizedFloatToByteSaturateReduce(
931
928
{
932
929
DebugGuard . IsTrue ( source . Length == destination . Length , nameof ( source ) , "Input spans must be of same length!" ) ;
933
930
934
- if ( ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported ) ||
935
- ( Vector256 . IsHardwareAccelerated && Avx2 . IsSupported ) ||
936
- ( Vector128 . IsHardwareAccelerated && ( Sse2 . IsSupported || AdvSimd . IsSupported ) ) )
931
+ if ( Sse2 . IsSupported || AdvSimd . IsSupported )
937
932
{
938
933
int remainder ;
939
934
940
- if ( Avx512BW . IsSupported )
935
+ if ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported )
941
936
{
942
937
remainder = Numerics . ModuloP2 ( source . Length , Vector512 < byte > . Count ) ;
943
938
}
@@ -977,7 +972,7 @@ internal static void NormalizedFloatToByteSaturate(
977
972
ReadOnlySpan < float > source ,
978
973
Span < byte > destination )
979
974
{
980
- if ( Avx512BW . IsSupported )
975
+ if ( Vector512 . IsHardwareAccelerated && Avx512BW . IsSupported )
981
976
{
982
977
DebugVerifySpanInput ( source , destination , Vector512 < byte > . Count ) ;
983
978
@@ -1011,8 +1006,7 @@ internal static void NormalizedFloatToByteSaturate(
1011
1006
Unsafe . Add ( ref destinationBase , i ) = b;
1012
1007
}
1013
1008
}
1014
- else
1015
- if ( Avx2 . IsSupported )
1009
+ else if ( Avx2 . IsSupported )
1016
1010
{
1017
1011
DebugVerifySpanInput ( source , destination , Vector256 < byte > . Count ) ;
1018
1012
@@ -1046,7 +1040,7 @@ internal static void NormalizedFloatToByteSaturate(
1046
1040
Unsafe . Add ( ref destinationBase , i ) = b;
1047
1041
}
1048
1042
}
1049
- else
1043
+ else if ( Sse2 . IsSupported || AdvSimd . IsSupported )
1050
1044
{
1051
1045
// Sse, AdvSimd
1052
1046
DebugVerifySpanInput ( source , destination , Vector128 < byte > . Count ) ;
0 commit comments