Skip to content

Commit e9b0555

Browse files
authored
Merge branch 'release/9.0-staging' into backport/pr-112469-to-release/9.0-staging
2 parents 122b120 + d082f40 commit e9b0555

File tree

3 files changed

+193
-53
lines changed

3 files changed

+193
-53
lines changed

src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorPrimitives.MultiplyAddEstimate.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ public static Vector128<T> Invoke(Vector128<T> x, Vector128<T> y, Vector128<T> z
128128
{
129129
return Vector128.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>();
130130
}
131-
else
131+
else if (typeof(T) == typeof(float))
132132
{
133-
Debug.Assert(typeof(T) == typeof(float));
134133
return Vector128.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
135134
}
136135
#else
@@ -149,9 +148,9 @@ public static Vector128<T> Invoke(Vector128<T> x, Vector128<T> y, Vector128<T> z
149148
{
150149
if (typeof(T) == typeof(double)) return AdvSimd.Arm64.FusedMultiplyAdd(z.AsDouble(), x.AsDouble(), y.AsDouble()).As<double, T>();
151150
}
151+
#endif
152152

153153
return (x * y) + z;
154-
#endif
155154
}
156155

157156
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -162,9 +161,8 @@ public static Vector256<T> Invoke(Vector256<T> x, Vector256<T> y, Vector256<T> z
162161
{
163162
return Vector256.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>();
164163
}
165-
else
164+
else if (typeof(T) == typeof(float))
166165
{
167-
Debug.Assert(typeof(T) == typeof(float));
168166
return Vector256.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
169167
}
170168
#else
@@ -173,9 +171,9 @@ public static Vector256<T> Invoke(Vector256<T> x, Vector256<T> y, Vector256<T> z
173171
if (typeof(T) == typeof(float)) return Fma.MultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
174172
if (typeof(T) == typeof(double)) return Fma.MultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>();
175173
}
174+
#endif
176175

177176
return (x * y) + z;
178-
#endif
179177
}
180178

181179
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -186,9 +184,8 @@ public static Vector512<T> Invoke(Vector512<T> x, Vector512<T> y, Vector512<T> z
186184
{
187185
return Vector512.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>();
188186
}
189-
else
187+
else if (typeof(T) == typeof(float))
190188
{
191-
Debug.Assert(typeof(T) == typeof(float));
192189
return Vector512.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
193190
}
194191
#else
@@ -197,9 +194,9 @@ public static Vector512<T> Invoke(Vector512<T> x, Vector512<T> y, Vector512<T> z
197194
if (typeof(T) == typeof(float)) return Avx512F.FusedMultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
198195
if (typeof(T) == typeof(double)) return Avx512F.FusedMultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>();
199196
}
197+
#endif
200198

201199
return (x * y) + z;
202-
#endif
203200
}
204201
}
205202
}

0 commit comments

Comments
 (0)