162 references to As
System.Numerics.Tensors (115)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (10)
2743x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsByte(), Vector128.Create((byte)8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7)).As<byte, T>()); 2744x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsByte(), Vector128.Create((byte)4, 5, 6, 7, 0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 2745x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsByte(), Vector128.Create((byte)2, 3, 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 2746x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsByte(), Vector128.Create((byte)1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 2750x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt16(), Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As<short, T>()); 2751x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt16(), Vector128.Create(2, 3, 0, 1, 4, 5, 6, 7)).As<short, T>()); 2752x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt16(), Vector128.Create(1, 0, 2, 3, 4, 5, 6, 7)).As<short, T>()); 2756x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt32(), Vector128.Create(2, 3, 0, 1)).As<int, T>()); 2757x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt32(), Vector128.Create(1, 0, 3, 2)).As<int, T>()); 2762x = TAggregate.Invoke(x, Vector128.Shuffle(x.AsInt64(), Vector128.Create(1, 0)).As<long, T>());
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IIndexOfMinMaxOperator.cs (3)
141resultIndex = ElementWiseSelect(mask.As<T, TInt>(), currentIndex, resultIndex); 148Vector128<TInt> aggMask = ~Vector128.Equals(result.As<T, TInt>(), Vector128.Create(aggResult).As<T, TInt>());
System\Numerics\Tensors\netcore\TensorPrimitives.Asin.cs (2)
47return Vector128.Asin(x.AsDouble()).As<double, T>(); 52return Vector128.Asin(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.BitDecrement.cs (2)
63return Vector128.ConditionalSelect(specialMask, specialValue, result).AsSingle().As<float, T>(); 85return Vector128.ConditionalSelect(specialMask, specialValue, result).AsDouble().As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.BitIncrement.cs (2)
63return Vector128.ConditionalSelect(specialMask, specialValue, result).AsSingle().As<float, T>(); 85return Vector128.ConditionalSelect(specialMask, specialValue, result).AsDouble().As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Cbrt.cs (2)
37return ExpOperator<float>.Invoke(LogOperator<float>.Invoke(x.AsSingle()) / Vector128.Create(3f)).As<float, T>(); 42return ExpOperator<double>.Invoke(LogOperator<double>.Invoke(x.AsDouble()) / Vector128.Create(3d)).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Ceiling.cs (2)
42return Vector128.Ceiling(x.AsSingle()).As<float, T>(); 47return Vector128.Ceiling(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertToInteger.cs (4)
42Vector128.ConvertToInt32(x.AsSingle()).As<int, TTo>() : 43Vector128.ConvertToUInt32(x.AsSingle()).As<uint, TTo>(); 49Vector128.ConvertToInt64(x.AsDouble()).As<long, TTo>() : 50Vector128.ConvertToUInt64(x.AsDouble()).As<ulong, TTo>();
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertToIntegerNative.cs (4)
42Vector128.ConvertToInt32Native(x.AsSingle()).As<int, TTo>() : 43Vector128.ConvertToUInt32Native(x.AsSingle()).As<uint, TTo>(); 49Vector128.ConvertToInt64Native(x.AsDouble()).As<long, TTo>() : 50Vector128.ConvertToUInt64Native(x.AsDouble()).As<ulong, TTo>();
System\Numerics\Tensors\netcore\TensorPrimitives.Cos.cs (2)
79return Vector128.Cos(x.AsDouble()).As<double, T>(); 84return Vector128.Cos(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Cosh.cs (2)
88return (Vector128.Create((float)Single_HALFV) * (z + (Vector128.Create((float)Single_INVV2) / z))).As<float, T>(); 97return (Vector128.Create(Double_HALFV) * (z + (Vector128.Create(Double_INVV2) / z))).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.CosPi.cs (2)
56return ApplyScalar<CosPiOperator<float>>(x.AsSingle()).As<float, T>(); 64return ApplyScalar<CosPiOperator<double>>(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.DegreesToRadians.cs (2)
43return Vector128.DegreesToRadians(x.AsDouble()).As<double, T>(); 48return Vector128.DegreesToRadians(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Exp.cs (2)
53return Vector128.Exp(x.AsDouble()).As<double, T>(); 58return Vector128.Exp(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Floor.cs (2)
42return Vector128.Floor(x.AsSingle()).As<float, T>(); 47return Vector128.Floor(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.FusedMultiplyAdd.cs (2)
128return Vector128.FusedMultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>(); 133return Vector128.FusedMultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Hypot.cs (2)
47return Vector128.Hypot(x.AsDouble(), y.AsDouble()).As<double, T>(); 52return Vector128.Hypot(x.AsSingle(), y.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMax.cs (6)
106if (typeof(T) == typeof(float)) return Sse41.BlendVariable(left.AsSingle(), right.AsSingle(), (~mask).AsSingle()).As<float, T>(); 107if (typeof(T) == typeof(double)) return Sse41.BlendVariable(left.AsDouble(), right.AsDouble(), (~mask).AsDouble()).As<double, T>(); 109if (sizeof(T) == 1) return Sse41.BlendVariable(left.AsByte(), right.AsByte(), (~mask).AsByte()).As<byte, T>(); 110if (sizeof(T) == 2) return Sse41.BlendVariable(left.AsUInt16(), right.AsUInt16(), (~mask).AsUInt16()).As<ushort, T>(); 111if (sizeof(T) == 4) return Sse41.BlendVariable(left.AsUInt32(), right.AsUInt32(), (~mask).AsUInt32()).As<uint, T>(); 112if (sizeof(T) == 8) return Sse41.BlendVariable(left.AsUInt64(), right.AsUInt64(), (~mask).AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.LeadingZeroCount.cs (9)
56return Avx512Vbmi.VL.PermuteVar16x8x2(lookupVectorLow, indexVector, lookupVectorHigh).As<byte, T>(); 69return (lz_bot16 | lz_top16_shift).AsUInt16().As<ushort, T>(); 74return Avx512CD.VL.LeadingZeroCount(x.AsUInt32()).As<uint, T>(); 79return Avx512CD.VL.LeadingZeroCount(x.AsUInt64()).As<ulong, T>(); 85if (sizeof(T) == 1) return AdvSimd.LeadingZeroCount(x.AsByte()).As<byte, T>(); 86if (sizeof(T) == 2) return AdvSimd.LeadingZeroCount(x.AsUInt16()).As<ushort, T>(); 89return AdvSimd.LeadingZeroCount(x.AsUInt32()).As<uint, T>(); 102return (Vector128.Create((byte)8) - PopCountOperator<byte>.Invoke(v)).As<byte, T>(); 112return (Vector128.Create((ushort)16) - PopCountOperator<ushort>.Invoke(v)).As<ushort, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Lerp.cs (2)
107return Vector128.Lerp(x.AsDouble(), y.AsDouble(), amount.AsDouble()).As<double, T>(); 112return Vector128.Lerp(x.AsSingle(), y.AsSingle(), amount.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Log.cs (2)
109return Vector128.Log(x.AsDouble()).As<double, T>(); 114return Vector128.Log(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Log2.cs (2)
55return Vector128.Log2(x.AsDouble()).As<double, T>(); 60return Vector128.Log2(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.MultiplyAddEstimate.cs (2)
128return Vector128.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>(); 132return Vector128.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.PopCount.cs (8)
66return cnt.As<byte, T>(); 71return AdvSimd.AddPairwiseWidening(cnt).As<ushort, T>(); 76return AdvSimd.AddPairwiseWidening(AdvSimd.AddPairwiseWidening(cnt)).As<uint, T>(); 81return AdvSimd.AddPairwiseWidening(AdvSimd.AddPairwiseWidening(AdvSimd.AddPairwiseWidening(cnt))).As<ulong, T>(); 89return PackedSimd.PopCount(x.AsByte()).As<byte, T>(); 103return ((tmp + (tmp.AsUInt16() >> 4).AsByte()) & c3).As<byte, T>(); 117return tmp.As<ushort, T>(); 131return tmp.As<uint, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Pow.cs (2)
70return ExpOperator<float>.Invoke(y.AsSingle() * LogOperator<float>.Invoke(x.AsSingle())).As<float, T>(); 75return ExpOperator<double>.Invoke(y.AsDouble() * LogOperator<double>.Invoke(x.AsDouble())).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.RadiansToDegrees.cs (2)
36return Vector128.RadiansToDegrees(x.AsDouble()).As<double, T>(); 41return Vector128.RadiansToDegrees(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Reciprocal.cs (10)
128if (typeof(T) == typeof(float)) return Avx512F.VL.Reciprocal14(x.AsSingle()).As<float, T>(); 129if (typeof(T) == typeof(double)) return Avx512F.VL.Reciprocal14(x.AsDouble()).As<double, T>(); 134if (typeof(T) == typeof(float)) return Sse.Reciprocal(x.AsSingle()).As<float, T>(); 139if (typeof(T) == typeof(float)) return AdvSimd.ReciprocalEstimate(x.AsSingle()).As<float, T>(); 144if (typeof(T) == typeof(double)) return AdvSimd.Arm64.ReciprocalEstimate(x.AsDouble()).As<double, T>(); 188if (typeof(T) == typeof(float)) return Avx512F.VL.ReciprocalSqrt14(x.AsSingle()).As<float, T>(); 189if (typeof(T) == typeof(double)) return Avx512F.VL.ReciprocalSqrt14(x.AsDouble()).As<double, T>(); 194if (typeof(T) == typeof(float)) return Sse.ReciprocalSqrt(x.AsSingle()).As<float, T>(); 199if (typeof(T) == typeof(float)) return AdvSimd.ReciprocalSquareRootEstimate(x.AsSingle()).As<float, T>(); 204if (typeof(T) == typeof(double)) return AdvSimd.Arm64.ReciprocalSquareRootEstimate(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Remainder.cs (2)
98typeof(T) == typeof(float) ? x - (TruncateOperator<float>.Invoke((x / y).AsSingle()).As<float, T>() * y) : 99typeof(T) == typeof(double) ? x - (TruncateOperator<double>.Invoke((x / y).AsDouble()).As<double, T>() * y) :
System\Numerics\Tensors\netcore\TensorPrimitives.RootN.cs (2)
39return ExpOperator<float>.Invoke(LogOperator<float>.Invoke(x.AsSingle()) / Vector128.Create((float)_n)).As<float, T>(); 44return ExpOperator<double>.Invoke(LogOperator<double>.Invoke(x.AsDouble()) / Vector128.Create((double)_n)).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Round.cs (6)
150return Vector128.Round(x.AsDouble()).As<double, T>(); 155return Vector128.Round(x.AsSingle()).As<float, T>(); 199return AdvSimd.RoundAwayFromZero(x.AsSingle()).As<float, T>(); 202return TruncateOperator<float>.Invoke(x.AsSingle() + CopySignOperator<float>.Invoke(Vector128.Create(0.49999997f), x.AsSingle())).As<float, T>(); 208return AdvSimd.Arm64.RoundAwayFromZero(x.AsDouble()).As<double, T>(); 212return TruncateOperator<double>.Invoke(x.AsDouble() + CopySignOperator<double>.Invoke(Vector128.Create(0.49999999999999994), x.AsDouble())).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Sin.cs (2)
69return Vector128.Sin(x.AsDouble()).As<double, T>(); 74return Vector128.Sin(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Sinh.cs (2)
72return (sign ^ result.AsUInt32()).As<uint, T>(); 83return (sign ^ result.AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.SinPi.cs (2)
56return ApplyScalar<SinPiOperator<float>>(x.AsSingle()).As<float, T>(); 64return ApplyScalar<SinPiOperator<double>>(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Tan.cs (2)
72return TanOperatorSingle.Invoke(x.AsSingle()).As<float, T>(); 77return TanOperatorDouble.Invoke(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Tanh.cs (2)
79return (sign ^ (-z / (z + Vector128.Create(2f))).AsUInt32()).As<uint, T>(); 88return (sign ^ (-z / (z + Vector128.Create(2d))).AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.TrailingZeroCount.cs (1)
41return AdvSimd.LeadingZeroCount(AdvSimd.Arm64.ReverseElementBits(x.AsByte())).As<byte, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Truncate.cs (2)
44return Vector128.Truncate(x.AsDouble()).As<double, T>(); 49return Vector128.Truncate(x.AsSingle()).As<float, T>();
System.Private.CoreLib (47)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (2)
163hexLow.As<byte, TChar>().StoreUnsafe(ref destRef, pos * 2); 168Vector128.WidenLower(hexLow).As<ushort, TChar>().StoreUnsafe(ref destRef, pos * 2);
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.MinMax.cs (10)
321Vector128.Create((byte)8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7)).As<byte, T>()); 323Vector128.Create((byte)4, 5, 6, 7, 0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 325Vector128.Create((byte)2, 3, 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 327Vector128.Create((byte)1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)).As<byte, T>()); 332Vector128.Create(4, 5, 6, 7, 0, 1, 2, 3)).As<short, T>()); 334Vector128.Create(2, 3, 0, 1, 4, 5, 6, 7)).As<short, T>()); 336Vector128.Create(1, 0, 2, 3, 4, 5, 6, 7)).As<short, T>()); 340x = TMinMax.Compare(x, Vector128.Shuffle(x.AsInt32(), Vector128.Create(2, 3, 0, 1)).As<int, T>()); 341x = TMinMax.Compare(x, Vector128.Shuffle(x.AsInt32(), Vector128.Create(1, 0, 3, 2)).As<int, T>()); 346x = TMinMax.Compare(x, Vector128.Shuffle(x.AsInt64(), Vector128.Create(1, 0)).As<long, T>());
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128_1.cs (2)
345return vector ^ Vector128<float>.NegativeZero.As<float, T>(); 349return vector ^ Vector128<double>.NegativeZero.As<double, T>();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (30)
282public static Vector128<byte> AsByte<T>(this Vector128<T> vector) => vector.As<T, byte>(); 290public static Vector128<double> AsDouble<T>(this Vector128<T> vector) => vector.As<T, double>(); 298public static Vector128<short> AsInt16<T>(this Vector128<T> vector) => vector.As<T, short>(); 306public static Vector128<int> AsInt32<T>(this Vector128<T> vector) => vector.As<T, int>(); 314public static Vector128<long> AsInt64<T>(this Vector128<T> vector) => vector.As<T, long>(); 322public static Vector128<nint> AsNInt<T>(this Vector128<T> vector) => vector.As<T, nint>(); 331public static Vector128<nuint> AsNUInt<T>(this Vector128<T> vector) => vector.As<T, nuint>(); 340public static Vector128<sbyte> AsSByte<T>(this Vector128<T> vector) => vector.As<T, sbyte>(); 348public static Vector128<float> AsSingle<T>(this Vector128<T> vector) => vector.As<T, float>(); 357public static Vector128<ushort> AsUInt16<T>(this Vector128<T> vector) => vector.As<T, ushort>(); 366public static Vector128<uint> AsUInt32<T>(this Vector128<T> vector) => vector.As<T, uint>(); 375public static Vector128<ulong> AsUInt64<T>(this Vector128<T> vector) => vector.As<T, ulong>(); 2159return VectorMath.IsEvenIntegerSingle<Vector128<float>, Vector128<uint>>(vector.AsSingle()).As<float, T>(); 2163return VectorMath.IsEvenIntegerDouble<Vector128<double>, Vector128<ulong>>(vector.AsDouble()).As<double, T>(); 2175return ~IsZero(AndNot(Create<uint>(float.PositiveInfinityBits), vector.AsUInt32())).As<uint, T>(); 2179return ~IsZero(AndNot(Create<ulong>(double.PositiveInfinityBits), vector.AsUInt64())).As<ulong, T>(); 2231return LessThan(vector.AsInt32(), Vector128<int>.Zero).As<int, T>(); 2235return LessThan(vector.AsInt64(), Vector128<long>.Zero).As<long, T>(); 2250return Equals(vector, Vector128<float>.NegativeInfinity.As<float, T>()); 2254return Equals(vector, Vector128<double>.NegativeInfinity.As<double, T>()); 2266return LessThan(Abs(vector).AsUInt32() - Create<uint>(float.SmallestNormalBits), Create<uint>(float.PositiveInfinityBits - float.SmallestNormalBits)).As<uint, T>(); 2270return LessThan(Abs(vector).AsUInt64() - Create<ulong>(double.SmallestNormalBits), Create<ulong>(double.PositiveInfinityBits - double.SmallestNormalBits)).As<ulong, T>(); 2282return VectorMath.IsOddIntegerSingle<Vector128<float>, Vector128<uint>>(vector.AsSingle()).As<float, T>(); 2286return VectorMath.IsOddIntegerDouble<Vector128<double>, Vector128<ulong>>(vector.AsDouble()).As<double, T>(); 2302return GreaterThanOrEqual(vector.AsInt32(), Vector128<int>.Zero).As<int, T>(); 2306return GreaterThanOrEqual(vector.AsInt64(), Vector128<long>.Zero).As<long, T>(); 2321return Equals(vector, Vector128<float>.PositiveInfinity.As<float, T>()); 2325return Equals(vector, Vector128<double>.PositiveInfinity.As<double, T>()); 2337return LessThan(Abs(vector).AsUInt32() - Vector128<uint>.One, Create<uint>(float.MaxTrailingSignificand)).As<uint, T>(); 2341return LessThan(Abs(vector).AsUInt64() - Vector128<ulong>.One, Create<ulong>(double.MaxTrailingSignificand)).As<ulong, T>();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (3)
475Vector128.StoreUnsafe(vector.As<TFrom, TTo>(), ref *pDest, elementOffset); 510return Vector128.LessThan(left.AsSByte(), right.AsSByte()).As<sbyte, T>(); 514return Vector128.LessThan(left.AsInt16(), right.AsInt16()).As<short, T>();