diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netcore.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netcore.cs index 0eaa0681036eb..c66a3b258c318 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netcore.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netcore.cs @@ -1256,28 +1256,10 @@ public static float Invoke(Vector512 x) private readonly struct AbsoluteOperator : IUnaryOperator { public static float Invoke(float x) => MathF.Abs(x); - - public static Vector128 Invoke(Vector128 x) - { - Vector128 raw = x.AsUInt32(); - Vector128 mask = Vector128.Create((uint)0x7FFFFFFF); - return (raw & mask).AsSingle(); - } - - public static Vector256 Invoke(Vector256 x) - { - Vector256 raw = x.AsUInt32(); - Vector256 mask = Vector256.Create((uint)0x7FFFFFFF); - return (raw & mask).AsSingle(); - } - + public static Vector128 Invoke(Vector128 x) => Vector128.Abs(x); + public static Vector256 Invoke(Vector256 x) => Vector256.Abs(x); #if NET8_0_OR_GREATER - public static Vector512 Invoke(Vector512 x) - { - Vector512 raw = x.AsUInt32(); - Vector512 mask = Vector512.Create((uint)0x7FFFFFFF); - return (raw & mask).AsSingle(); - } + public static Vector512 Invoke(Vector512 x) => Vector512.Abs(x); #endif } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs index ed8b3aea0d560..1ffd5d30683e9 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs @@ -572,13 +572,7 @@ public Vector Invoke(Vector x, Vector y) private readonly struct AbsoluteOperator : IUnaryOperator { public float Invoke(float x) => MathF.Abs(x); - - public Vector Invoke(Vector x) - { - Vector raw = Vector.AsVectorUInt32(x); - Vector mask = new Vector(0x7FFFFFFF); - return Vector.AsVectorSingle(raw & mask); - } + public Vector Invoke(Vector x) => Vector.Abs(x); } private interface IUnaryOperator