Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d04768c

Browse files
committed
Adding scalar hardware intrinsics for x86.
1 parent 1724c75 commit d04768c

File tree

12 files changed

+1181
-6
lines changed

12 files changed

+1181
-6
lines changed

src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.PlatformNotSupported.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,21 @@ public static class Avx
117117
/// __m256d _mm256_cmp_pd (__m256d a, __m256d b, const int imm8)
118118
/// </summary>
119119
public static Vector256<double> Compare(Vector256<double> left, Vector256<double> right, FloatComparisonMode mode) { throw new PlatformNotSupportedException(); }
120-
120+
121+
/// <summary>
122+
/// __m128d _mm_cmp_sd (__m128d a, __m128d b, const int imm8)
123+
/// </summary>
124+
public static Vector128<double> CompareScalar(Vector128<double> left, Vector128<double> right, FloatComparisonMode mode) { throw new PlatformNotSupportedException(); }
125+
/// <summary>
126+
/// __m128 _mm_cmp_ss (__m128 a, __m128 b, const int imm8)
127+
/// </summary>
128+
public static Vector128<float> CompareScalar(Vector128<float> left, Vector128<float> right, FloatComparisonMode mode) { throw new PlatformNotSupportedException(); }
129+
130+
/// <summary>
131+
/// float _mm256_cvtss_f32 (__m256 a)
132+
/// </summary>
133+
public static float ConvertToSingle(Vector256<float> value) { throw new PlatformNotSupportedException(); }
134+
121135
/// <summary>
122136
/// __m128i _mm256_cvtpd_epi32 (__m256d a)
123137
/// </summary>

src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,21 @@ public static class Avx
117117
/// __m256d _mm256_cmp_pd (__m256d a, __m256d b, const int imm8)
118118
/// </summary>
119119
public static Vector256<double> Compare(Vector256<double> left, Vector256<double> right, FloatComparisonMode mode) => Compare(left, right, mode);
120-
120+
121+
/// <summary>
122+
/// __m128d _mm_cmp_sd (__m128d a, __m128d b, const int imm8)
123+
/// </summary>
124+
public static Vector128<double> CompareScalar(Vector128<double> left, Vector128<double> right, FloatComparisonMode mode) => CompareScalar(left, right, mode);
125+
/// <summary>
126+
/// __m128 _mm_cmp_ss (__m128 a, __m128 b, const int imm8)
127+
/// </summary>
128+
public static Vector128<float> CompareScalar(Vector128<float> left, Vector128<float> right, FloatComparisonMode mode) => CompareScalar(left, right, mode);
129+
130+
/// <summary>
131+
/// float _mm256_cvtss_f32 (__m256 a)
132+
/// </summary>
133+
public static float ConvertToSingle(Vector256<float> value) => ConvertToSingle(value);
134+
121135
/// <summary>
122136
/// __m128i _mm256_cvtpd_epi32 (__m256d a)
123137
/// </summary>

src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,19 @@ public static class Avx2
295295
/// </summary>
296296
public static Vector256<long> CompareGreaterThan(Vector256<long> left, Vector256<long> right) { throw new PlatformNotSupportedException(); }
297297

298+
/// <summary>
299+
/// double _mm256_cvtsd_f64 (__m256d a)
300+
/// </summary>
301+
public static double ConvertToDouble(Vector256<double> value) { throw new PlatformNotSupportedException(); }
302+
/// <summary>
303+
/// int _mm256_cvtsi256_si32 (__m256i a)
304+
/// </summary>
305+
public static int ConvertToInt32(Vector256<int> value) { throw new PlatformNotSupportedException(); }
306+
/// <summary>
307+
/// int _mm256_cvtsi256_si32 (__m256i a)
308+
/// </summary>
309+
public static uint ConvertToUInt32(Vector256<uint> value) { throw new PlatformNotSupportedException(); }
310+
298311
/// <summary>
299312
/// __m256i _mm256_cvtepi8_epi16 (__m128i a)
300313
/// </summary>

src/mscorlib/src/System/Runtime/Intrinsics/X86/Avx2.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,19 @@ public static Vector256<T> BroadcastElementToVector256<T>(Vector128<T> value) wh
303303
/// </summary>
304304
public static Vector256<long> CompareGreaterThan(Vector256<long> left, Vector256<long> right) => CompareGreaterThan(left, right);
305305

306+
/// <summary>
307+
/// double _mm256_cvtsd_f64 (__m256d a)
308+
/// </summary>
309+
public static double ConvertToDouble(Vector256<double> value) => ConvertToDouble(value);
310+
/// <summary>
311+
/// int _mm256_cvtsi256_si32 (__m256i a)
312+
/// </summary>
313+
public static int ConvertToInt32(Vector256<int> value) => ConvertToInt32(value);
314+
/// <summary>
315+
/// int _mm256_cvtsi256_si32 (__m256i a)
316+
/// </summary>
317+
public static uint ConvertToUInt32(Vector256<uint> value) => ConvertToUInt32(value);
318+
306319
/// <summary>
307320
/// __m256i _mm256_cvtepi8_epi16 (__m128i a)
308321
/// </summary>

src/mscorlib/src/System/Runtime/Intrinsics/X86/Fma.PlatformNotSupported.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ public static class Fma
3131
/// </summary>
3232
public static Vector256<double> MultiplyAdd(Vector256<double> a, Vector256<double> b, Vector256<double> c) { throw new PlatformNotSupportedException(); }
3333

34+
/// <summary>
35+
/// __m128 _mm_fmadd_ss (__m128 a, __m128 b, __m128 c)
36+
/// </summary>
37+
public static Vector128<float> MultiplyAddScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) { throw new PlatformNotSupportedException(); }
38+
/// <summary>
39+
/// __m128d _mm_fmadd_sd (__m128d a, __m128d b, __m128d c)
40+
/// </summary>
41+
public static Vector128<double> MultiplyAddScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) { throw new PlatformNotSupportedException(); }
42+
3443
/// <summary>
3544
/// __m128 _mm_fmaddsub_ps (__m128 a, __m128 b, __m128 c)
3645
/// </summary>
@@ -65,6 +74,15 @@ public static class Fma
6574
/// </summary>
6675
public static Vector256<double> MultiplySubtract(Vector256<double> a, Vector256<double> b, Vector256<double> c) { throw new PlatformNotSupportedException(); }
6776

77+
/// <summary>
78+
/// __m128 _mm_fmsub_ss (__m128 a, __m128 b, __m128 c)
79+
/// </summary>
80+
public static Vector128<float> MultiplySubtractScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) { throw new PlatformNotSupportedException(); }
81+
/// <summary>
82+
/// __m128d _mm_fmsub_sd (__m128d a, __m128d b, __m128d c)
83+
/// </summary>
84+
public static Vector128<double> MultiplySubtractScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) { throw new PlatformNotSupportedException(); }
85+
6886
/// <summary>
6987
/// __m128 _mm_fmsubadd_ps (__m128 a, __m128 b, __m128 c)
7088
/// </summary>
@@ -99,6 +117,15 @@ public static class Fma
99117
/// </summary>
100118
public static Vector256<double> MultiplyAddNegated(Vector256<double> a, Vector256<double> b, Vector256<double> c) { throw new PlatformNotSupportedException(); }
101119

120+
/// <summary>
121+
/// __m128 _mm_fnmadd_ss (__m128 a, __m128 b, __m128 c)
122+
/// </summary>
123+
public static Vector128<float> MultiplyAddNegatedScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) { throw new PlatformNotSupportedException(); }
124+
/// <summary>
125+
/// __m128d _mm_fnmadd_sd (__m128d a, __m128d b, __m128d c)
126+
/// </summary>
127+
public static Vector128<double> MultiplyAddNegatedScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) { throw new PlatformNotSupportedException(); }
128+
102129
/// <summary>
103130
/// __m128 _mm_fnmsub_ps (__m128 a, __m128 b, __m128 c)
104131
/// </summary>
@@ -115,5 +142,14 @@ public static class Fma
115142
/// __m256d _mm256_fnmsub_pd (__m256d a, __m256d b, __m256d c)
116143
/// </summary>
117144
public static Vector256<double> MultiplySubtractNegated(Vector256<double> a, Vector256<double> b, Vector256<double> c) { throw new PlatformNotSupportedException(); }
145+
146+
/// <summary>
147+
/// __m128 _mm_fnmsub_ss (__m128 a, __m128 b, __m128 c)
148+
/// </summary>
149+
public static Vector128<float> MultiplySubtractNegatedScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) { throw new PlatformNotSupportedException(); }
150+
/// <summary>
151+
/// __m128d _mm_fnmsub_sd (__m128d a, __m128d b, __m128d c)
152+
/// </summary>
153+
public static Vector128<double> MultiplySubtractNegatedScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) { throw new PlatformNotSupportedException(); }
118154
}
119155
}

src/mscorlib/src/System/Runtime/Intrinsics/X86/Fma.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ public static class Fma
3131
/// </summary>
3232
public static Vector256<double> MultiplyAdd(Vector256<double> a, Vector256<double> b, Vector256<double> c) => MultiplyAdd(a, b, c);
3333

34+
/// <summary>
35+
/// __m128 _mm_fmadd_ss (__m128 a, __m128 b, __m128 c)
36+
/// </summary>
37+
public static Vector128<float> MultiplyAddScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) => MultiplyAddScalar(a, b, c);
38+
/// <summary>
39+
/// __m128d _mm_fmadd_sd (__m128d a, __m128d b, __m128d c)
40+
/// </summary>
41+
public static Vector128<double> MultiplyAddScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) => MultiplyAddScalar(a, b, c);
42+
3443
/// <summary>
3544
/// __m128 _mm_fmaddsub_ps (__m128 a, __m128 b, __m128 c)
3645
/// </summary>
@@ -65,6 +74,15 @@ public static class Fma
6574
/// </summary>
6675
public static Vector256<double> MultiplySubtract(Vector256<double> a, Vector256<double> b, Vector256<double> c) => MultiplySubtract(a, b, c);
6776

77+
/// <summary>
78+
/// __m128 _mm_fmsub_ss (__m128 a, __m128 b, __m128 c)
79+
/// </summary>
80+
public static Vector128<float> MultiplySubtractScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) => MultiplySubtractScalar(a, b, c);
81+
/// <summary>
82+
/// __m128d _mm_fmsub_sd (__m128d a, __m128d b, __m128d c)
83+
/// </summary>
84+
public static Vector128<double> MultiplySubtractScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) => MultiplySubtractScalar(a, b, c);
85+
6886
/// <summary>
6987
/// __m128 _mm_fmsubadd_ps (__m128 a, __m128 b, __m128 c)
7088
/// </summary>
@@ -99,6 +117,15 @@ public static class Fma
99117
/// </summary>
100118
public static Vector256<double> MultiplyAddNegated(Vector256<double> a, Vector256<double> b, Vector256<double> c) => MultiplyAddNegated(a, b, c);
101119

120+
/// <summary>
121+
/// __m128 _mm_fnmadd_ss (__m128 a, __m128 b, __m128 c)
122+
/// </summary>
123+
public static Vector128<float> MultiplyAddNegatedScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) => MultiplyAddNegatedScalar(a, b, c);
124+
/// <summary>
125+
/// __m128d _mm_fnmadd_sd (__m128d a, __m128d b, __m128d c)
126+
/// </summary>
127+
public static Vector128<double> MultiplyAddNegatedScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) => MultiplyAddNegatedScalar(a, b, c);
128+
102129
/// <summary>
103130
/// __m128 _mm_fnmsub_ps (__m128 a, __m128 b, __m128 c)
104131
/// </summary>
@@ -115,5 +142,14 @@ public static class Fma
115142
/// __m256d _mm256_fnmsub_pd (__m256d a, __m256d b, __m256d c)
116143
/// </summary>
117144
public static Vector256<double> MultiplySubtractNegated(Vector256<double> a, Vector256<double> b, Vector256<double> c) => MultiplySubtractNegated(a, b, c);
145+
146+
/// <summary>
147+
/// __m128 _mm_fnmsub_ss (__m128 a, __m128 b, __m128 c)
148+
/// </summary>
149+
public static Vector128<float> MultiplySubtractNegatedScalar(Vector128<float> a, Vector128<float> b, Vector128<float> c) => MultiplySubtractNegatedScalar(a, b, c);
150+
/// <summary>
151+
/// __m128d _mm_fnmsub_sd (__m128d a, __m128d b, __m128d c)
152+
/// </summary>
153+
public static Vector128<double> MultiplySubtractNegatedScalar(Vector128<double> a, Vector128<double> b, Vector128<double> c) => MultiplySubtractNegatedScalar(a, b, c);
118154
}
119155
}

0 commit comments

Comments
 (0)