System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (148)
19static abstract T Invoke(Vector256<T> x);
34public Vector256<T> Invoke(Vector256<T> x) => TOperator.Invoke(x);
92if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TTransformOperator.Vectorizable)
96if (remainder >= (uint)Vector256<T>.Count)
333Vector256<T> vresult = Vector256.Create(TAggregationOperator.IdentityValue);
337Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
338Vector256<T> end = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
342if (remainder > (uint)(Vector256<T>.Count * 8))
368misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)xPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
372Debug.Assert(((nuint)xPtr % (uint)sizeof(Vector256<T>)) == 0);
382misalignment = (uint)Vector256<T>.Count;
387Vector256<T> vector1;
388Vector256<T> vector2;
389Vector256<T> vector3;
390Vector256<T> vector4;
394while (remainder >= (uint)(Vector256<T>.Count * 8))
398vector1 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)));
399vector2 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)));
400vector3 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)));
401vector4 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)));
410vector1 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)));
411vector2 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)));
412vector3 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)));
413vector4 = transform.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)));
423xPtr += (uint)(Vector256<T>.Count * 8);
425remainder -= (uint)(Vector256<T>.Count * 8);
446(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
454Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)));
461Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)));
468Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)));
475Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)));
482Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)));
489Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)));
496Vector256<T> vector = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 1)));
760Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
761Vector256<T> end = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
763end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
774Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
915Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
916Vector256<T> end = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
918end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
929Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
1021Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
1022Vector256<T> end = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
1024end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
1034Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
1106Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
1107Vector256<T> end = transform.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
1109end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
1119Vector256<T> beg = transform.Invoke(Vector256.LoadUnsafe(ref xRef));
1211if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TBinaryOperator.Vectorizable)
1215if (remainder >= (uint)Vector256<T>.Count)
1479Vector256<T> vresult = Vector256.Create(TAggregationOperator.IdentityValue);
1483Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1485Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1486Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
1490if (remainder > (uint)(Vector256<T>.Count * 8))
1518misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)xPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
1523Debug.Assert(((nuint)xPtr % (uint)sizeof(Vector256<T>)) == 0);
1533misalignment = (uint)Vector256<T>.Count;
1541Vector256<T> vector1;
1542Vector256<T> vector2;
1543Vector256<T> vector3;
1544Vector256<T> vector4;
1548while (remainder >= (uint)(Vector256<T>.Count * 8))
1552vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
1553Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)));
1554vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
1555Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)));
1556vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
1557Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)));
1558vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
1559Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)));
1568vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
1569Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)));
1570vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
1571Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)));
1572vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
1573Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)));
1574vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
1575Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)));
1585xPtr += (uint)(Vector256<T>.Count * 8);
1586yPtr += (uint)(Vector256<T>.Count * 8);
1588remainder -= (uint)(Vector256<T>.Count * 8);
1610(nuint blocks, nuint trailing) = Math.DivRem(remainder, (nuint)Vector256<T>.Count);
1618Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)),
1619Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 7)));
1626Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)),
1627Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 6)));
1634Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)),
1635Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 5)));
1642Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)),
1643Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 4)));
1650Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)),
1651Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 3)));
1658Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)),
1659Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 2)));
1666Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 1)),
1667Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 1)));
1956Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1958Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1959Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
1961end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
1972Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2117Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2119Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2120Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
2122end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
2133Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2229Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2231Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2232Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
2234end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
2244Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2322Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2324Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2325Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
2327end = Vector256.ConditionalSelect(CreateRemainderMaskVector256<T>((int)(remainder % (uint)Vector256<T>.Count)), end, Vector256.Create(TAggregationOperator.IdentityValue));
2337Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2427private static Vector256<T> CreateAlignmentMaskVector256<T>(int count)
2535private static Vector256<T> CreateRemainderMaskVector256<T>(int count)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBinaryOperator.cs (238)
19static abstract Vector256<T> Invoke(Vector256<T> x, Vector256<T> y);
103if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TBinaryOperator.Vectorizable)
105if (remainder >= (uint)Vector256<T>.Count)
402Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
404Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
405Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
407if (remainder > (uint)(Vector256<T>.Count * 8))
434nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
440Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
445Vector256<T> vector1;
446Vector256<T> vector2;
447Vector256<T> vector3;
448Vector256<T> vector4;
455while (remainder >= (uint)(Vector256<T>.Count * 8))
459vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
460Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)));
461vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
462Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)));
463vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
464Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)));
465vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
466Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)));
468vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
469vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
470vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
471vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
475vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
476Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)));
477vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
478Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)));
479vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
480Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)));
481vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
482Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)));
484vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
485vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
486vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
487vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
492xPtr += (uint)(Vector256<T>.Count * 8);
493yPtr += (uint)(Vector256<T>.Count * 8);
494dPtr += (uint)(Vector256<T>.Count * 8);
496remainder -= (uint)(Vector256<T>.Count * 8);
501while (remainder >= (uint)(Vector256<T>.Count * 8))
505vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
506Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)));
507vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
508Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)));
509vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
510Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)));
511vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
512Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)));
514vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
515vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
516vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
517vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
521vector1 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
522Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)));
523vector2 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
524Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)));
525vector3 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
526Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)));
527vector4 = TBinaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
528Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)));
530vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
531vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
532vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
533vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
538xPtr += (uint)(Vector256<T>.Count * 8);
539yPtr += (uint)(Vector256<T>.Count * 8);
540dPtr += (uint)(Vector256<T>.Count * 8);
542remainder -= (uint)(Vector256<T>.Count * 8);
562remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
564switch (remainder / (uint)Vector256<T>.Count)
568Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8)),
569Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 8)));
570vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
576Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)),
577Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 7)));
578vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
584Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)),
585Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 6)));
586vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
592Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)),
593Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 5)));
594vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
600Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)),
601Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 4)));
602vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
608Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)),
609Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 3)));
610vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
616Vector256<T> vector = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)),
617Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 2)));
618vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
625end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
944Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
946Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
947Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
950end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
960Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1116Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1118Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1119Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
1122end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1132Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1231Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1233Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1234Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
1237end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1246Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1321Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1323Vector256<T> end = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1324Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count));
1327end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1336Vector256<T> beg = TBinaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1435if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TTransformOperator.Vectorizable && TBinaryOperator.Vectorizable)
1437if (remainder >= (uint)Vector256<T>.Count)
1730Vector256<T> yVec = Vector256.Create(y);
1732Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
1734Vector256<T> end = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count)),
1737if (remainder > (uint)(Vector256<T>.Count * 8))
1762nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
1767Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
1772Vector256<T> vector1;
1773Vector256<T> vector2;
1774Vector256<T> vector3;
1775Vector256<T> vector4;
1782while (remainder >= (uint)(Vector256<T>.Count * 8))
1786vector1 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0))),
1788vector2 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1))),
1790vector3 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2))),
1792vector4 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3))),
1795vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
1796vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
1797vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
1798vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
1802vector1 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4))),
1804vector2 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5))),
1806vector3 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6))),
1808vector4 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7))),
1811vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
1812vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
1813vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
1814vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
1819xPtr += (uint)(Vector256<T>.Count * 8);
1820dPtr += (uint)(Vector256<T>.Count * 8);
1822remainder -= (uint)(Vector256<T>.Count * 8);
1827while (remainder >= (uint)(Vector256<T>.Count * 8))
1831vector1 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0))),
1833vector2 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1))),
1835vector3 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2))),
1837vector4 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3))),
1840vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
1841vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
1842vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
1843vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
1847vector1 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4))),
1849vector2 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5))),
1851vector3 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6))),
1853vector4 = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7))),
1856vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
1857vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
1858vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
1859vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
1864xPtr += (uint)(Vector256<T>.Count * 8);
1865dPtr += (uint)(Vector256<T>.Count * 8);
1867remainder -= (uint)(Vector256<T>.Count * 8);
1886remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
1888switch (remainder / (uint)Vector256<T>.Count)
1892Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8))),
1894vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
1900Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7))),
1902vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
1908Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6))),
1910vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
1916Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5))),
1918vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
1924Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4))),
1926vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
1932Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3))),
1934vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
1940Vector256<T> vector = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2))),
1942vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
1949end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
2264Vector256<T> yVec = Vector256.Create(y);
2266Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2268Vector256<T> end = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count)),
2272end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2282Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2440Vector256<T> yVec = Vector256.Create(y);
2442Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2444Vector256<T> end = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count)),
2448end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2458Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2559Vector256<T> yVec = Vector256.Create(y);
2561Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2563Vector256<T> end = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count)),
2567end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2576Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2653Vector256<T> yVec = Vector256.Create(y);
2655Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2657Vector256<T> end = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count)),
2661end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2670Vector256<T> beg = TBinaryOperator.Invoke(TTransformOperator.Invoke(Vector256.LoadUnsafe(ref xRef)),
2723private static T HorizontalAggregate<T, TAggregate>(Vector256<T> x) where TAggregate : struct, IBinaryOperator<T> =>
2774public static Vector256<T> Invoke(Vector256<T> x, Vector256<T> y) => TOperator.Invoke(y, x);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (47)
20static abstract Vector256<T> Invoke(Vector256<T> x);
29static abstract bool ShouldEarlyExit(Vector256<T> result);
40public static bool ShouldEarlyExit(Vector256<T> result) => Vector256.AnyWhereAllBitsSet(result);
55public static bool ShouldEarlyExit(Vector256<T> result) =>
56typeof(T) == typeof(float) ? Vector256.EqualsAny(result.AsUInt32(), Vector256<uint>.Zero) :
57typeof(T) == typeof(double) ? Vector256.EqualsAny(result.AsUInt64(), Vector256<ulong>.Zero) :
58Vector256.EqualsAny(result, Vector256<T>.Zero);
111if (Vector256.IsHardwareAccelerated && TOperator.Vectorizable && Vector256<T>.IsSupported)
113oneVectorFromEnd = x.Length - Vector256<T>.Count;
124i += Vector256<T>.Count;
130TAnyAll.ShouldEarlyExit(TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)))))
248if (Vector256.IsHardwareAccelerated && TOperator.Vectorizable && Vector256<T>.IsSupported)
250int vectorFromEnd = x.Length - Vector256<T>.Count;
257i += Vector256<T>.Count;
264i = x.Length - Vector256<T>.Count;
272Vector256<byte> v = TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)i)).AsByte();
274(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i);
359if (Vector256.IsHardwareAccelerated && TOperator.Vectorizable && Vector256<T>.IsSupported)
361int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T));
368i += Vector256<T>.Count * sizeof(T);
375i = x.Length - (Vector256<T>.Count * sizeof(T));
383Vector256<byte> v =
386TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + Vector256<T>.Count))).AsUInt16());
388(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i);
480if (Vector256.IsHardwareAccelerated && TOperator.Vectorizable && Vector256<T>.IsSupported)
482int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T));
489i += Vector256<T>.Count * sizeof(T);
496i = x.Length - (Vector256<T>.Count * sizeof(T));
504Vector256<byte> v =
508TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + Vector256<T>.Count))).AsUInt32()),
510TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (2 * Vector256<T>.Count)))).AsUInt32(),
511TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (3 * Vector256<T>.Count)))).AsUInt32()));
513(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i);
617if (Vector256.IsHardwareAccelerated && TOperator.Vectorizable && Vector256<T>.IsSupported)
621int vectorsFromEnd = x.Length - (Vector256<T>.Count * sizeof(T));
628i += Vector256<T>.Count * sizeof(T);
635i = x.Length - (Vector256<T>.Count * sizeof(T));
643Vector256<byte> v =
648TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + Vector256<T>.Count))).AsUInt64()),
650TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (2 * Vector256<T>.Count)))).AsUInt64(),
651TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (3 * Vector256<T>.Count)))).AsUInt64())),
654TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (4 * Vector256<T>.Count)))).AsUInt64(),
655TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (5 * Vector256<T>.Count)))).AsUInt64()),
657TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (6 * Vector256<T>.Count)))).AsUInt64(),
658TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)(i + (7 * Vector256<T>.Count)))).AsUInt64())));
660(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i);
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IIndexOfMinMaxOperator.cs (83)
15static abstract T Aggregate(Vector256<T> value);
19static abstract Vector256<T> Compare(Vector256<T> x, Vector256<T> y);
39if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count)
324Vector256<T> result = Vector256.Create(x);
327Vector256<T> nanMask = Vector256.IsNaN(result);
328if (nanMask != Vector256<T>.Zero)
335Vector256<TInt> indexIncrement = Vector256.Create(TInt.CreateTruncating(Vector256<TInt>.Count));
336Vector256<TInt> resultIndex = Vector256<TInt>.Indices;
337Vector256<TInt> currentIndex = resultIndex + indexIncrement;
338ReadOnlySpan<T> span = x.Slice(Vector256<T>.Count);
342Vector256<T> current;
343if (span.Length >= Vector256<T>.Count)
346span = span.Slice(Vector256<T>.Count);
351int start = x.Length - Vector256<T>.Count;
353currentIndex = Vector256.Create(TInt.CreateTruncating(start)) + Vector256<TInt>.Indices;
360Vector256<T> nanMask = Vector256.IsNaN(current);
361if (nanMask != Vector256<T>.Zero)
368Vector256<T> mask = TOperator.Compare(current, result);
379Vector256<TInt> aggMask = ~Vector256.Equals(result.As<T, TInt>(), Vector256.Create(aggResult).As<T, TInt>());
380Vector256<TInt> aggIndex = resultIndex | aggMask;
391Vector256<T> result = Vector256.Create(x);
394Vector256<T> nanMask = Vector256.IsNaN(result);
395if (nanMask != Vector256<T>.Zero)
402Vector256<uint> indexIncrement = Vector256.Create((uint)Vector256<uint>.Count);
403Vector256<uint> resultIndex1 = Vector256<uint>.Indices;
404Vector256<uint> resultIndex2 = resultIndex1 + indexIncrement;
405Vector256<uint> currentIndex = resultIndex2 + indexIncrement;
406ReadOnlySpan<T> span = x.Slice(Vector256<T>.Count);
410Vector256<T> current;
411if (span.Length >= Vector256<T>.Count)
414span = span.Slice(Vector256<T>.Count);
419int start = x.Length - Vector256<T>.Count;
421currentIndex = Vector256.Create((uint)start) + Vector256<uint>.Indices;
428Vector256<T> nanMask = Vector256.IsNaN(current);
429if (nanMask != Vector256<T>.Zero)
436Vector256<T> mask = TOperator.Compare(current, result);
437(Vector256<int> mask1, Vector256<int> mask2) = Vector256.Widen(mask.AsInt16());
450Vector256<short> aggMask = ~Vector256.Equals(result.AsInt16(), Vector256.Create(aggResult).AsInt16());
452(Vector256<int> mask1, Vector256<int> mask2) = Vector256.Widen(aggMask);
453Vector256<uint> aggIndex = resultIndex1 | mask1.AsUInt32();
466Vector256<T> result = Vector256.Create(x);
469Vector256<T> nanMask = Vector256.IsNaN(result);
470if (nanMask != Vector256<T>.Zero)
477Vector256<uint> indexIncrement = Vector256.Create((uint)Vector256<uint>.Count);
478Vector256<uint> resultIndex1 = Vector256<uint>.Indices;
479Vector256<uint> resultIndex2 = resultIndex1 + indexIncrement;
480Vector256<uint> resultIndex3 = resultIndex2 + indexIncrement;
481Vector256<uint> resultIndex4 = resultIndex3 + indexIncrement;
482Vector256<uint> currentIndex = resultIndex4 + indexIncrement;
483ReadOnlySpan<T> span = x.Slice(Vector256<T>.Count);
487Vector256<T> current;
488if (span.Length >= Vector256<T>.Count)
491span = span.Slice(Vector256<T>.Count);
496int start = x.Length - Vector256<T>.Count;
498currentIndex = Vector256.Create((uint)start) + Vector256<uint>.Indices;
505Vector256<T> nanMask = Vector256.IsNaN(current);
506if (nanMask != Vector256<T>.Zero)
513Vector256<T> mask = TOperator.Compare(current, result);
514(Vector256<short> lowerMask, Vector256<short> upperMask) = Vector256.Widen(mask.AsSByte());
515(Vector256<int> mask1, Vector256<int> mask2) = Vector256.Widen(lowerMask);
516(Vector256<int> mask3, Vector256<int> mask4) = Vector256.Widen(upperMask);
533Vector256<sbyte> aggMask = ~Vector256.Equals(result.AsSByte(), Vector256.Create(aggResult).AsSByte());
535(Vector256<short> lowerMask, Vector256<short> upperMask) = Vector256.Widen(aggMask);
536(Vector256<int> mask1, Vector256<int> mask2) = Vector256.Widen(lowerMask);
537(Vector256<int> mask3, Vector256<int> mask4) = Vector256.Widen(upperMask);
538Vector256<uint> aggIndex = resultIndex1 | mask1.AsUInt32();
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IStatefulUnaryOperator.cs (100)
19Vector256<T> Invoke(Vector256<T> x);
69if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TStatefulUnaryOperator.Vectorizable)
71if (remainder >= (uint)Vector256<T>.Count)
336Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
337Vector256<T> end = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
339if (remainder > (uint)(Vector256<T>.Count * 8))
364nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
369Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
374Vector256<T> vector1;
375Vector256<T> vector2;
376Vector256<T> vector3;
377Vector256<T> vector4;
384while (remainder >= (uint)(Vector256<T>.Count * 8))
388vector1 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)));
389vector2 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)));
390vector3 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)));
391vector4 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)));
393vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
394vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
395vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
396vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
400vector1 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)));
401vector2 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)));
402vector3 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)));
403vector4 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)));
405vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
406vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
407vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
408vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
413xPtr += (uint)(Vector256<T>.Count * 8);
414dPtr += (uint)(Vector256<T>.Count * 8);
416remainder -= (uint)(Vector256<T>.Count * 8);
421while (remainder >= (uint)(Vector256<T>.Count * 8))
425vector1 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)));
426vector2 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)));
427vector3 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)));
428vector4 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)));
430vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
431vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
432vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
433vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
437vector1 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)));
438vector2 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)));
439vector3 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)));
440vector4 = op.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)));
442vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
443vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
444vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
445vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
450xPtr += (uint)(Vector256<T>.Count * 8);
451dPtr += (uint)(Vector256<T>.Count * 8);
453remainder -= (uint)(Vector256<T>.Count * 8);
472remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
474switch (remainder / (uint)Vector256<T>.Count)
478Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8)));
479vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
485Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)));
486vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
492Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)));
493vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
499Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)));
500vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
506Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)));
507vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
513Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)));
514vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
520Vector256<T> vector = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)));
521vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
528end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
816Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
817Vector256<T> end = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
820end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
830Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
968Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
969Vector256<T> end = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
972end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
982Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
1071Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
1072Vector256<T> end = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
1075end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1084Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
1153Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
1154Vector256<T> end = op.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count));
1157end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1166Vector256<T> beg = op.Invoke(Vector256.LoadUnsafe(ref xRef));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.ITernaryOperator.cs (407)
19static abstract Vector256<T> Invoke(Vector256<T> x, Vector256<T> y, Vector256<T> z);
29public static Vector256<T> Invoke(Vector256<T> x, Vector256<T> y, Vector256<T> z) => TOperator.Invoke(x, z, y);
90if (TTernaryOperator.Vectorizable && Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported)
92if (remainder >= (uint)Vector256<T>.Count)
421Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
424Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
425Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
426Vector256.LoadUnsafe(ref zRef, remainder - (uint)Vector256<T>.Count));
428if (remainder > (uint)(Vector256<T>.Count * 8))
457nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (nuint)sizeof(T);
464Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
469Vector256<T> vector1;
470Vector256<T> vector2;
471Vector256<T> vector3;
472Vector256<T> vector4;
479while (remainder >= (uint)(Vector256<T>.Count * 8))
483vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
484Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)),
485Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 0)));
486vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
487Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)),
488Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 1)));
489vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
490Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)),
491Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 2)));
492vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
493Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)),
494Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 3)));
496vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
497vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
498vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
499vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
503vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
504Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)),
505Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 4)));
506vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
507Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)),
508Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 5)));
509vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
510Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)),
511Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 6)));
512vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
513Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)),
514Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 7)));
516vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
517vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
518vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
519vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
524xPtr += (uint)(Vector256<T>.Count * 8);
525yPtr += (uint)(Vector256<T>.Count * 8);
526zPtr += (uint)(Vector256<T>.Count * 8);
527dPtr += (uint)(Vector256<T>.Count * 8);
529remainder -= (uint)(Vector256<T>.Count * 8);
534while (remainder >= (uint)(Vector256<T>.Count * 8))
538vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
539Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)),
540Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 0)));
541vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
542Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)),
543Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 1)));
544vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
545Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)),
546Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 2)));
547vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
548Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)),
549Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 3)));
551vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
552vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
553vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
554vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
558vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
559Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)),
560Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 4)));
561vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
562Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)),
563Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 5)));
564vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
565Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)),
566Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 6)));
567vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
568Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)),
569Vector256.Load(zPtr + (uint)(Vector256<T>.Count * 7)));
571vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
572vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
573vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
574vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
579xPtr += (uint)(Vector256<T>.Count * 8);
580yPtr += (uint)(Vector256<T>.Count * 8);
581zPtr += (uint)(Vector256<T>.Count * 8);
582dPtr += (uint)(Vector256<T>.Count * 8);
584remainder -= (uint)(Vector256<T>.Count * 8);
605remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
607switch (remainder / (uint)Vector256<T>.Count)
611Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8)),
612Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 8)),
613Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 8)));
614vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
620Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)),
621Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 7)),
622Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 7)));
623vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
629Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)),
630Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 6)),
631Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 6)));
632vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
638Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)),
639Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 5)),
640Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 5)));
641vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
647Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)),
648Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 4)),
649Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 4)));
650vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
656Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)),
657Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 3)),
658Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 3)));
659vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
665Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)),
666Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 2)),
667Vector256.LoadUnsafe(ref zRef, remainder - (uint)(Vector256<T>.Count * 2)));
668vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
675end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
1025Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1028Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1029Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
1030Vector256.LoadUnsafe(ref zRef, remainder - (uint)Vector256<T>.Count));
1033end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1043Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1217Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1220Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1221Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
1222Vector256.LoadUnsafe(ref zRef, remainder - (uint)Vector256<T>.Count));
1225end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1235Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1344Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1347Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1348Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
1349Vector256.LoadUnsafe(ref zRef, remainder - (uint)Vector256<T>.Count));
1352end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1361Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1442Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1445Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1446Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
1447Vector256.LoadUnsafe(ref zRef, remainder - (uint)Vector256<T>.Count));
1450end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
1459Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1565if (TTernaryOperator.Vectorizable && Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported)
1567if (remainder >= (uint)Vector256<T>.Count)
1892Vector256<T> zVec = Vector256.Create(z);
1894Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
1897Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
1898Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
1901if (remainder > (uint)(Vector256<T>.Count * 8))
1928nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
1934Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
1939Vector256<T> vector1;
1940Vector256<T> vector2;
1941Vector256<T> vector3;
1942Vector256<T> vector4;
1949while (remainder >= (uint)(Vector256<T>.Count * 8))
1953vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
1954Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)),
1956vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
1957Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)),
1959vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
1960Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)),
1962vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
1963Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)),
1966vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
1967vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
1968vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
1969vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
1973vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
1974Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)),
1976vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
1977Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)),
1979vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
1980Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)),
1982vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
1983Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)),
1986vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
1987vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
1988vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
1989vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
1994xPtr += (uint)(Vector256<T>.Count * 8);
1995yPtr += (uint)(Vector256<T>.Count * 8);
1996dPtr += (uint)(Vector256<T>.Count * 8);
1998remainder -= (uint)(Vector256<T>.Count * 8);
2003while (remainder >= (uint)(Vector256<T>.Count * 8))
2007vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
2008Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 0)),
2010vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
2011Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 1)),
2013vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
2014Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 2)),
2016vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
2017Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 3)),
2020vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
2021vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
2022vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
2023vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
2027vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
2028Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 4)),
2030vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
2031Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 5)),
2033vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
2034Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 6)),
2036vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
2037Vector256.Load(yPtr + (uint)(Vector256<T>.Count * 7)),
2040vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
2041vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
2042vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
2043vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
2048xPtr += (uint)(Vector256<T>.Count * 8);
2049yPtr += (uint)(Vector256<T>.Count * 8);
2050dPtr += (uint)(Vector256<T>.Count * 8);
2052remainder -= (uint)(Vector256<T>.Count * 8);
2072remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
2074switch (remainder / (uint)Vector256<T>.Count)
2078Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8)),
2079Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 8)),
2081vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
2087Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)),
2088Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 7)),
2090vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
2096Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)),
2097Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 6)),
2099vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
2105Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)),
2106Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 5)),
2108vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
2114Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)),
2115Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 4)),
2117vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
2123Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)),
2124Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 3)),
2126vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
2132Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)),
2133Vector256.LoadUnsafe(ref yRef, remainder - (uint)(Vector256<T>.Count * 2)),
2135vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
2142end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
2488Vector256<T> zVec = Vector256.Create(z);
2490Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2493Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2494Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
2498end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2508Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2684Vector256<T> zVec = Vector256.Create(z);
2686Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2689Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2690Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
2694end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2704Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2815Vector256<T> zVec = Vector256.Create(z);
2817Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2820Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2821Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
2825end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2834Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2917Vector256<T> zVec = Vector256.Create(z);
2919Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
2922Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
2923Vector256.LoadUnsafe(ref yRef, remainder - (uint)Vector256<T>.Count),
2927end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
2936Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
3051if (TTernaryOperator.Vectorizable && Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported)
3053if (remainder >= (uint)Vector256<T>.Count)
3373Vector256<T> yVec = Vector256.Create(y);
3374Vector256<T> zVec = Vector256.Create(z);
3376Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
3379Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
3383if (remainder > (uint)(Vector256<T>.Count * 8))
3408nuint misalignment = ((uint)sizeof(Vector256<T>) - ((nuint)dPtr % (uint)sizeof(Vector256<T>))) / (uint)sizeof(T);
3413Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<T>)) == 0);
3418Vector256<T> vector1;
3419Vector256<T> vector2;
3420Vector256<T> vector3;
3421Vector256<T> vector4;
3428while (remainder >= (uint)(Vector256<T>.Count * 8))
3432vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
3435vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
3438vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
3441vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
3445vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 0));
3446vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 1));
3447vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 2));
3448vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 3));
3452vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
3455vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
3458vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
3461vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
3465vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 4));
3466vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 5));
3467vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 6));
3468vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<T>.Count * 7));
3473xPtr += (uint)(Vector256<T>.Count * 8);
3474dPtr += (uint)(Vector256<T>.Count * 8);
3476remainder -= (uint)(Vector256<T>.Count * 8);
3481while (remainder >= (uint)(Vector256<T>.Count * 8))
3485vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 0)),
3488vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 1)),
3491vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 2)),
3494vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 3)),
3498vector1.Store(dPtr + (uint)(Vector256<T>.Count * 0));
3499vector2.Store(dPtr + (uint)(Vector256<T>.Count * 1));
3500vector3.Store(dPtr + (uint)(Vector256<T>.Count * 2));
3501vector4.Store(dPtr + (uint)(Vector256<T>.Count * 3));
3505vector1 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 4)),
3508vector2 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 5)),
3511vector3 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 6)),
3514vector4 = TTernaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<T>.Count * 7)),
3518vector1.Store(dPtr + (uint)(Vector256<T>.Count * 4));
3519vector2.Store(dPtr + (uint)(Vector256<T>.Count * 5));
3520vector3.Store(dPtr + (uint)(Vector256<T>.Count * 6));
3521vector4.Store(dPtr + (uint)(Vector256<T>.Count * 7));
3526xPtr += (uint)(Vector256<T>.Count * 8);
3527dPtr += (uint)(Vector256<T>.Count * 8);
3529remainder -= (uint)(Vector256<T>.Count * 8);
3548remainder = (remainder + (uint)(Vector256<T>.Count - 1)) & (nuint)(-Vector256<T>.Count);
3550switch (remainder / (uint)Vector256<T>.Count)
3554Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 8)),
3557vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 8));
3563Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 7)),
3566vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 7));
3572Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 6)),
3575vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 6));
3581Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 5)),
3584vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 5));
3590Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 4)),
3593vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 4));
3599Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 3)),
3602vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 3));
3608Vector256<T> vector = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<T>.Count * 2)),
3611vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<T>.Count * 2));
3618end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<T>.Count);
3959Vector256<T> yVec = Vector256.Create(y);
3960Vector256<T> zVec = Vector256.Create(z);
3962Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
3965Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
3970end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
3980Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4157Vector256<T> yVec = Vector256.Create(y);
4158Vector256<T> zVec = Vector256.Create(z);
4160Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4163Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
4168end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
4178Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4290Vector256<T> yVec = Vector256.Create(y);
4291Vector256<T> zVec = Vector256.Create(z);
4293Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4296Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
4301end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
4310Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4394Vector256<T> yVec = Vector256.Create(y);
4395Vector256<T> zVec = Vector256.Create(z);
4397Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
4400Vector256<T> end = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<T>.Count),
4405end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<T>.Count);
4414Vector256<T> beg = TTernaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (40)
18static abstract (Vector256<T> First, Vector256<T> Second) Invoke(Vector256<T> x);
28static abstract (Vector256<T> First, Vector256<T> Second) Invoke(Vector256<T> x, Vector256<T> y);
39public static (Vector256<T> First, Vector256<T> Second) Invoke(Vector256<T> x, Vector256<T> y) => TOperator.Invoke(y, x);
100if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TUnaryOperator.Vectorizable)
102oneVectorFromEnd = x.Length - Vector256<T>.Count;
108(Vector256<T> first, Vector256<T> second) = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref sourceRef, (uint)i));
112i += Vector256<T>.Count;
119i = x.Length - Vector256<T>.Count;
121(Vector256<T> first, Vector256<T> second) = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref sourceRef, (uint)i));
253if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TOperator.Vectorizable)
255oneVectorFromEnd = x.Length - Vector256<T>.Count;
261(Vector256<T> first, Vector256<T> second) = TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)i), Vector256.LoadUnsafe(ref yRef, (uint)i));
265i += Vector256<T>.Count;
272Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero);
274i = x.Length - Vector256<T>.Count;
276Vector256<T> first = Vector256.ConditionalSelect(mask,
280Vector256<T> second = Vector256.ConditionalSelect(mask,
436if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && TOperator.Vectorizable)
438oneVectorFromEnd = x.Length - Vector256<T>.Count;
441Vector256<T> yVec = Vector256.Create(y);
446(Vector256<T> first, Vector256<T> second) = TOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)i), yVec);
450i += Vector256<T>.Count;
457Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero);
459i = x.Length - Vector256<T>.Count;
461Vector256<T> first = Vector256.ConditionalSelect(mask,
465Vector256<T> second = Vector256.ConditionalSelect(mask,
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOneToFourOperator.cs (24)
20static abstract (Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>) Invoke(Vector256<TInput> x);
83Debug.Assert(Vector256<TInput>.IsSupported);
84Debug.Assert(Vector256<TOutput>.IsSupported);
86oneVectorFromEnd = x.Length - Vector256<TInput>.Count;
92(Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>) results = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref sourceRef, (uint)i));
94results.Item2.StoreUnsafe(ref destinationRef, (uint)(i + Vector256<TOutput>.Count));
95results.Item3.StoreUnsafe(ref destinationRef, (uint)(i + (Vector256<TOutput>.Count * 2)));
96results.Item4.StoreUnsafe(ref destinationRef, (uint)(i + (Vector256<TOutput>.Count * 3)));
98i += Vector256<TInput>.Count;
105i = x.Length - Vector256<TInput>.Count;
107(Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>, Vector256<TOutput>) results = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref sourceRef, (uint)i));
109results.Item2.StoreUnsafe(ref destinationRef, (uint)(i + Vector256<TOutput>.Count));
110results.Item3.StoreUnsafe(ref destinationRef, (uint)(i + (Vector256<TOutput>.Count * 2)));
111results.Item4.StoreUnsafe(ref destinationRef, (uint)(i + (Vector256<TOutput>.Count * 3)));
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryOperator.cs (103)
36static abstract Vector256<TOutput> Invoke(Vector256<TInput> x);
46public static Vector256<T> Invoke(Vector256<T> x) => x;
109if (Vector256.IsHardwareAccelerated && Vector256<TInput>.IsSupported && Vector256<TOutput>.IsSupported && TUnaryOperator.Vectorizable && sizeof(TInput) == sizeof(TOutput))
111if (remainder >= (uint)Vector256<TInput>.Count)
376Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
377Vector256<TOutput> end = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<TInput>.Count));
379if (remainder > (uint)(Vector256<TInput>.Count * 8))
404nuint misalignment = ((uint)sizeof(Vector256<TInput>) - ((nuint)dPtr % (uint)sizeof(Vector256<TInput>))) / (uint)sizeof(TInput);
409Debug.Assert(((nuint)dPtr % (uint)sizeof(Vector256<TInput>)) == 0);
414Vector256<TOutput> vector1;
415Vector256<TOutput> vector2;
416Vector256<TOutput> vector3;
417Vector256<TOutput> vector4;
424while (remainder >= (uint)(Vector256<TInput>.Count * 8))
428vector1 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 0)));
429vector2 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 1)));
430vector3 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 2)));
431vector4 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 3)));
433vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 0));
434vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 1));
435vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 2));
436vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 3));
440vector1 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 4)));
441vector2 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 5)));
442vector3 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 6)));
443vector4 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 7)));
445vector1.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 4));
446vector2.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 5));
447vector3.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 6));
448vector4.StoreAlignedNonTemporal(dPtr + (uint)(Vector256<TOutput>.Count * 7));
453xPtr += (uint)(Vector256<TInput>.Count * 8);
454dPtr += (uint)(Vector256<TOutput>.Count * 8);
456remainder -= (uint)(Vector256<TInput>.Count * 8);
461while (remainder >= (uint)(Vector256<TInput>.Count * 8))
465vector1 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 0)));
466vector2 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 1)));
467vector3 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 2)));
468vector4 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 3)));
470vector1.Store(dPtr + (uint)(Vector256<TOutput>.Count * 0));
471vector2.Store(dPtr + (uint)(Vector256<TOutput>.Count * 1));
472vector3.Store(dPtr + (uint)(Vector256<TOutput>.Count * 2));
473vector4.Store(dPtr + (uint)(Vector256<TOutput>.Count * 3));
477vector1 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 4)));
478vector2 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 5)));
479vector3 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 6)));
480vector4 = TUnaryOperator.Invoke(Vector256.Load(xPtr + (uint)(Vector256<TInput>.Count * 7)));
482vector1.Store(dPtr + (uint)(Vector256<TOutput>.Count * 4));
483vector2.Store(dPtr + (uint)(Vector256<TOutput>.Count * 5));
484vector3.Store(dPtr + (uint)(Vector256<TOutput>.Count * 6));
485vector4.Store(dPtr + (uint)(Vector256<TOutput>.Count * 7));
490xPtr += (uint)(Vector256<TInput>.Count * 8);
491dPtr += (uint)(Vector256<TOutput>.Count * 8);
493remainder -= (uint)(Vector256<TInput>.Count * 8);
512remainder = (remainder + (uint)(Vector256<TInput>.Count - 1)) & (nuint)(-Vector256<TInput>.Count);
514switch (remainder / (uint)Vector256<TInput>.Count)
518Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 8)));
519vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 8));
525Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 7)));
526vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 7));
532Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 6)));
533vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 6));
539Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 5)));
540vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 5));
546Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 4)));
547vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 4));
553Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 3)));
554vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 3));
560Vector256<TOutput> vector = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)(Vector256<TInput>.Count * 2)));
561vector.StoreUnsafe(ref dRef, remainder - (uint)(Vector256<TOutput>.Count * 2));
568end.StoreUnsafe(ref dRef, endIndex - (uint)Vector256<TOutput>.Count);
856Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
857Vector256<TOutput> end = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<TInput>.Count));
860end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<TOutput>.Count);
870Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1008Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1009Vector256<TOutput> end = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<TInput>.Count));
1012end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<TOutput>.Count);
1022Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1111Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1112Vector256<TOutput> end = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<TInput>.Count));
1115end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<TOutput>.Count);
1124Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1193Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
1194Vector256<TOutput> end = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef, remainder - (uint)Vector256<TInput>.Count));
1197end.StoreUnsafe(ref dRef, remainder - (uint)Vector256<TOutput>.Count);
1206Vector256<TOutput> beg = TUnaryOperator.Invoke(Vector256.LoadUnsafe(ref xRef));
System\Numerics\Tensors\netcore\TensorPrimitives.Clamp.cs (12)
223public static Vector256<T> Invoke(Vector256<T> x, Vector256<T> min, Vector256<T> max) => Vector256.Clamp(x, min, max);
236public static Vector256<T> Invoke(Vector256<T> min, Vector256<T> max, Vector256<T> x) => Vector256.Clamp(x, min, max);
249public static Vector256<T> Invoke(Vector256<T> max, Vector256<T> x, Vector256<T> min) => Vector256.Clamp(x, min, max);
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertHelpers.cs (77)
169public static Vector256<float> Invoke(Vector256<int> x) => Vector256.ConvertToSingle(x);
180public static Vector256<float> Invoke(Vector256<uint> x) => Vector256.ConvertToSingle(x);
191public static Vector256<double> Invoke(Vector256<ulong> x) => Vector256.ConvertToDouble(x);
202public static Vector256<double> Invoke(Vector256<long> x) => Vector256.ConvertToDouble(x);
213public static (Vector256<double> Lower, Vector256<double> Upper) Invoke(Vector256<float> x) => Vector256.Widen(x);
224public static Vector256<float> Invoke(Vector256<double> lower, Vector256<double> upper) => Vector256.Narrow(lower, upper);
235public static (Vector256<ushort> Lower, Vector256<ushort> Upper) Invoke(Vector256<byte> x) => Vector256.Widen(x);
256public static (Vector256<uint>, Vector256<uint>, Vector256<uint>, Vector256<uint>) Invoke(Vector256<byte> x)
258(Vector256<ushort> Lower, Vector256<ushort> Upper) ushorts = Vector256.Widen(x);
259(Vector256<uint> Lower, Vector256<uint> Upper) uintsLower = Vector256.Widen(ushorts.Lower);
260(Vector256<uint> Lower, Vector256<uint> Upper) uintsUpper = Vector256.Widen(ushorts.Upper);
294public static (Vector256<float>, Vector256<float>, Vector256<float>, Vector256<float>) Invoke(Vector256<byte> x)
325public static (Vector256<short> Lower, Vector256<short> Upper) Invoke(Vector256<sbyte> x) => Vector256.Widen(x);
336public static (Vector256<uint> Lower, Vector256<uint> Upper) Invoke(Vector256<ushort> x) => Vector256.Widen(x);
347public static (Vector256<int> Lower, Vector256<int> Upper) Invoke(Vector256<short> x) => Vector256.Widen(x);
358public static (Vector256<ulong> Lower, Vector256<ulong> Upper) Invoke(Vector256<uint> x) => Vector256.Widen(x);
369public static (Vector256<long> Lower, Vector256<long> Upper) Invoke(Vector256<int> x) => Vector256.Widen(x);
444public static (Vector256<float> Lower, Vector256<float> Upper) Invoke(Vector256<short> x)
446(Vector256<int> lowerInt32, Vector256<int> upperInt32) = Vector256.Widen(x);
451static Vector256<float> HalfAsWidenedUInt32ToSingle(Vector256<uint> value)
454Vector256<uint> sign = value & Vector256.Create(SingleSignMask);
457Vector256<uint> bitValueInProcess = value;
460Vector256<uint> offsetExponent = bitValueInProcess & Vector256.Create(HalfExponentMask);
463Vector256<uint> subnormalMask = Vector256.Equals(offsetExponent, Vector256<uint>.Zero);
466Vector256<uint> infinityOrNaNMask = Vector256.Equals(offsetExponent, Vector256.Create(HalfExponentMask));
469Vector256<uint> maskedExponentLowerBound = subnormalMask & Vector256.Create(ExponentLowerBound);
472Vector256<uint> offsetMaskedExponentLowerBound = Vector256.Create(ExponentOffset) | maskedExponentLowerBound;
478offsetMaskedExponentLowerBound = Vector256.ConditionalSelect(Vector256.Equals(infinityOrNaNMask, Vector256<uint>.Zero),
489Vector256<uint> absoluteValue = (bitValueInProcess.AsSingle() - maskedExponentLowerBound.AsSingle()).AsUInt32();
637public static Vector256<ushort> Invoke(Vector256<float> lower, Vector256<float> upper)
643static Vector256<uint> SingleToHalfAsWidenedUInt32(Vector256<float> value)
645Vector256<uint> bitValue = value.AsUInt32();
648Vector256<uint> sign = Vector256.ShiftRightLogical(bitValue & Vector256.Create(SingleSignMask), 16);
651Vector256<uint> realMask = Vector256.Equals(value, value).AsUInt32();
660Vector256<uint> exponentOffset0 = Vector256.Max(value, Vector256.Create(MinExp).AsSingle()).AsUInt32();
673Vector256<uint> maskedHalfExponentForNaN = ~realMask & Vector256.Create(ExponentMask);
679Vector256<uint> newExponent = Vector256.ShiftRightLogical(bitValue, 13);
691Vector256<uint> signAndMaskedExponent = maskedHalfExponentForNaN | sign;
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertTruncating.cs (28)
111public static Vector256<int> Invoke(Vector256<float> x) => Vector256.ConvertToInt32(x);
123public static Vector256<uint> Invoke(Vector256<float> x) => Vector256.ConvertToUInt32(x);
135public static Vector256<ulong> Invoke(Vector256<double> x) => Vector256.ConvertToUInt64(x);
147public static Vector256<long> Invoke(Vector256<double> x) => Vector256.ConvertToInt64(x);
158public static Vector256<byte> Invoke(Vector256<ushort> lower, Vector256<ushort> upper) => Vector256.Narrow(lower, upper);
169public static Vector256<sbyte> Invoke(Vector256<short> lower, Vector256<short> upper) => Vector256.Narrow(lower, upper);
180public static Vector256<ushort> Invoke(Vector256<uint> lower, Vector256<uint> upper) => Vector256.Narrow(lower, upper);
191public static Vector256<short> Invoke(Vector256<int> lower, Vector256<int> upper) => Vector256.Narrow(lower, upper);
202public static Vector256<uint> Invoke(Vector256<ulong> lower, Vector256<ulong> upper) => Vector256.Narrow(lower, upper);
213public static Vector256<int> Invoke(Vector256<long> lower, Vector256<long> upper) => Vector256.Narrow(lower, upper);
224public static Vector256<TTo> Invoke(Vector256<TFrom> x) => throw new NotSupportedException();
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (41)
98if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count)
103Vector256<T> dotProductVector = Vector256<T>.Zero;
104Vector256<T> xSumOfSquaresVector = Vector256<T>.Zero;
105Vector256<T> ySumOfSquaresVector = Vector256<T>.Zero;
108int oneVectorFromEnd = x.Length - Vector256<T>.Count;
117i += Vector256<T>.Count;
124Vector256<T> remainderMask = CreateRemainderMaskVector256<T>(x.Length - i);
127Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask,
128Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask,
243if (Vector256.IsHardwareAccelerated && x.Length >= Vector256<short>.Count)
249Vector256<float> dotProductVector = Vector256<float>.Zero;
250Vector256<float> xSumOfSquaresVector = Vector256<float>.Zero;
251Vector256<float> ySumOfSquaresVector = Vector256<float>.Zero;
254int oneVectorFromEnd = x.Length - Vector256<short>.Count;
258(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(Vector256.LoadUnsafe(ref xRef, (uint)i));
259(Vector256<float> yVecLower, Vector256<float> yVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(Vector256.LoadUnsafe(ref yRef, (uint)i));
264i += Vector256<short>.Count;
271Vector256<short> remainderMask = CreateRemainderMaskVector256<short>(x.Length - i);
273(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(
274Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask);
275(Vector256<float> yVecLower, Vector256<float> yVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(
276Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask);
355private static void Update<T>(Vector256<T> xVec, Vector256<T> yVec, ref Vector256<T> dotProductVector, ref Vector256<T> xSumOfSquaresVector, ref Vector256<T> ySumOfSquaresVector) where T : INumberBase<T>
379private static T Finalize<T>(Vector256<T> dotProductVector, Vector256<T> xSumOfSquaresVector, Vector256<T> ySumOfSquaresVector) where T : IRootFunctions<T> =>
System\Numerics\Tensors\netcore\TensorPrimitives.Half.cs (31)
327public static Vector256<short> Invoke(Vector256<short> x)
329(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(x);
364public static Vector256<short> Invoke(Vector256<short> x, Vector256<short> y)
366(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(x);
367(Vector256<float> yVecLower, Vector256<float> yVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(y);
403public static Vector256<short> Invoke(Vector256<short> x, Vector256<short> y)
405(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(x);
406(Vector256<float> yVecLower, Vector256<float> yVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(y);
429public static short Invoke(Vector256<short> x)
431(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(x);
470public static Vector256<short> Invoke(Vector256<short> x, Vector256<short> y, Vector256<short> z)
472(Vector256<float> xVecLower, Vector256<float> xVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(x);
473(Vector256<float> yVecLower, Vector256<float> yVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(y);
474(Vector256<float> zVecLower, Vector256<float> zVecUpper) = WidenHalfAsInt16ToSingleOperator.Invoke(z);
System\Numerics\Tensors\netcore\TensorPrimitives.Tan.cs (48)
81public static Vector256<T> Invoke(Vector256<T> x)
163public static Vector256<float> Invoke(Vector256<float> x)
165Vector256<float> uxMasked = Vector256.Abs(x);
171Vector256<float> dn = MultiplyAddEstimateOperator<float>.Invoke(uxMasked, Vector256.Create(2 / float.Pi), Vector256.Create(AlmHuge));
172Vector256<uint> odd = dn.AsUInt32() << 31;
175Vector256<float> f = uxMasked;
181Vector256<float> f2 = f * f;
182Vector256<float> f4 = f2 * f2;
183Vector256<float> f8 = f4 * f4;
184Vector256<float> f12 = f8 * f4;
185Vector256<float> a1 = MultiplyAddEstimateOperator<float>.Invoke(Vector256.Create(C2), f2, Vector256.Create(C1));
186Vector256<float> a2 = MultiplyAddEstimateOperator<float>.Invoke(Vector256.Create(C4), f2, Vector256.Create(C3));
187Vector256<float> a3 = MultiplyAddEstimateOperator<float>.Invoke(Vector256.Create(C6), f2, Vector256.Create(C5));
188Vector256<float> b1 = MultiplyAddEstimateOperator<float>.Invoke(a2, f4, a1);
189Vector256<float> b2 = MultiplyAddEstimateOperator<float>.Invoke(f8, a3, f12 * Vector256.Create(C7));
190Vector256<float> poly = MultiplyAddEstimateOperator<float>.Invoke(f * f2, b1 + b2, f);
192Vector256<float> result = (poly.AsUInt32() ^ (x.AsUInt32() & Vector256.Create(~SignMask))).AsSingle();
193return Vector256.ConditionalSelect(Vector256.Equals(odd, Vector256<uint>.Zero).AsSingle(),
308public static Vector256<double> Invoke(Vector256<double> x)
310Vector256<double> uxMasked = Vector256.Abs(x);
317Vector256<double> dn = MultiplyAddEstimateOperator<double>.Invoke(uxMasked, Vector256.Create(2 / double.Pi), Vector256.Create(AlmHuge));
318Vector256<ulong> odd = dn.AsUInt64() << 63;
322Vector256<double> f = uxMasked;
328Vector256<double> g = f * f;
329Vector256<double> g2 = g * g;
330Vector256<double> g3 = g * g2;
331Vector256<double> g5 = g3 * g2;
332Vector256<double> g7 = g5 * g2;
333Vector256<double> g9 = g7 * g2;
334Vector256<double> g11 = g9 * g2;
335Vector256<double> g13 = g11 * g2;
336Vector256<double> a1 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C3), g, Vector256.Create(C1));
337Vector256<double> a2 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C7), g, Vector256.Create(C5));
338Vector256<double> a3 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C11), g, Vector256.Create(C9));
339Vector256<double> a4 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C15), g, Vector256.Create(C13));
340Vector256<double> a5 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C19), g, Vector256.Create(C17));
341Vector256<double> a6 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C23), g, Vector256.Create(C21));
342Vector256<double> a7 = MultiplyAddEstimateOperator<double>.Invoke(Vector256.Create(C27), g, Vector256.Create(C25));
343Vector256<double> b1 = MultiplyAddEstimateOperator<double>.Invoke(g, a1, g3 * a2);
344Vector256<double> b2 = MultiplyAddEstimateOperator<double>.Invoke(g5, a3, g7 * a4);
345Vector256<double> b3 = MultiplyAddEstimateOperator<double>.Invoke(g9, a5, g11 * a6);
346Vector256<double> q = MultiplyAddEstimateOperator<double>.Invoke(g13, a7, b1 + b2 + b3);
347Vector256<double> poly = MultiplyAddEstimateOperator<double>.Invoke(f, q, f);
349Vector256<double> result = (poly.AsUInt64() ^ (x.AsUInt64() & Vector256.Create(~SignMask))).AsDouble();
350return Vector256.ConditionalSelect(Vector256.Equals(odd, Vector256<ulong>.Zero).AsDouble(),