|
|
@ -436,6 +436,20 @@ internal static class Vector128_ |
|
|
return Vector128.Narrow(prodLo, prodHi); |
|
|
return Vector128.Narrow(prodLo, prodHi); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Multiply packed signed 16-bit integers in <paramref name="left"/> and <paramref name="right"/>, producing
|
|
|
|
|
|
/// intermediate signed 32-bit integers. Horizontally add adjacent pairs of intermediate 32-bit integers, and
|
|
|
|
|
|
/// pack the results.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="left">
|
|
|
|
|
|
/// The first vector containing packed signed 16-bit integers to multiply and add.
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
/// <param name="right">
|
|
|
|
|
|
/// The second vector containing packed signed 16-bit integers to multiply and add.
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
/// <returns>
|
|
|
|
|
|
/// A vector containing the results of multiplying and adding adjacent pairs of packed signed 16-bit integers
|
|
|
|
|
|
/// </returns>
|
|
|
public static Vector128<int> MultiplyAddAdjacent(Vector128<short> left, Vector128<short> right) |
|
|
public static Vector128<int> MultiplyAddAdjacent(Vector128<short> left, Vector128<short> right) |
|
|
{ |
|
|
{ |
|
|
if (Sse2.IsSupported) |
|
|
if (Sse2.IsSupported) |
|
|
@ -443,6 +457,18 @@ internal static class Vector128_ |
|
|
return Sse2.MultiplyAddAdjacent(left, right); |
|
|
return Sse2.MultiplyAddAdjacent(left, right); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (AdvSimd.IsSupported) |
|
|
|
|
|
{ |
|
|
|
|
|
Vector128<int> prodLo = AdvSimd.MultiplyWideningLower(left.GetLower(), right.GetLower()); |
|
|
|
|
|
Vector128<int> prodHi = AdvSimd.MultiplyWideningLower(left.GetUpper(), right.GetUpper()); |
|
|
|
|
|
|
|
|
|
|
|
Vector128<long> v0 = AdvSimd.AddPairwiseWidening(prodLo); |
|
|
|
|
|
Vector128<long> v1 = AdvSimd.AddPairwiseWidening(prodHi); |
|
|
|
|
|
|
|
|
|
|
|
return Vector128.Narrow(v0, v1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
// Widen each half of the short vectors into two int vectors
|
|
|
// Widen each half of the short vectors into two int vectors
|
|
|
(Vector128<int> leftLower, Vector128<int> leftUpper) = Vector128.Widen(left); |
|
|
(Vector128<int> leftLower, Vector128<int> leftUpper) = Vector128.Widen(left); |
|
|
(Vector128<int> rightLower, Vector128<int> rightUpper) = Vector128.Widen(right); |
|
|
(Vector128<int> rightLower, Vector128<int> rightUpper) = Vector128.Widen(right); |
|
|
@ -460,6 +486,7 @@ internal static class Vector128_ |
|
|
|
|
|
|
|
|
return v0 + v1 + v2 + v3; |
|
|
return v0 + v1 + v2 + v3; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Multiply the packed 16-bit integers in <paramref name="left"/> and <paramref name="right"/>, producing
|
|
|
/// Multiply the packed 16-bit integers in <paramref name="left"/> and <paramref name="right"/>, producing
|
|
|
|