Skip to content

Commit 2a6bf6f

Browse files
Change Vector2/3/4, Quaternion, Plane, Vector<T>, and Vector64/128/256/512<T> to be implemented in managed where trivially possible (#102301)
* Change Vector4 to be implemented entirely in managed * Change Plane to be implemented entirely in managed * Change Quaternion to be implemented entirely in managed * Avoid accidental recursion on Mono * Change Vector2/3, Vector<T>, and Vector64/128/256/512<T> to be implemented in managed where trivially possible * Don't regress the implementation of Dot * Fixing the handling of Vector512.CreateScalar * Continue tracking the System.Numerics and System.Runtime.Intrinsics APIs as intrinsic for the profitability boost * Don't use Unsafe.BitCast on Mono
1 parent 0c5fccf commit 2a6bf6f

28 files changed

+368
-2983
lines changed

src/coreclr/jit/fgbasic.cpp

-91
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,6 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
14001400
case NI_Vector3_Create:
14011401
case NI_Vector3_CreateBroadcast:
14021402
case NI_Vector3_CreateFromVector2:
1403-
case NI_Vector4_Create:
1404-
case NI_Vector4_CreateBroadcast:
1405-
case NI_Vector4_CreateFromVector2:
1406-
case NI_Vector4_CreateFromVector3:
14071403
case NI_Vector128_Create:
14081404
case NI_Vector128_CreateScalar:
14091405
case NI_Vector128_CreateScalarUnsafe:
@@ -1630,82 +1626,6 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
16301626
break;
16311627
}
16321628

1633-
#if defined(FEATURE_HW_INTRINSICS)
1634-
#if defined(TARGET_ARM64)
1635-
case NI_Vector64_As:
1636-
case NI_Vector64_AsByte:
1637-
case NI_Vector64_AsDouble:
1638-
case NI_Vector64_AsInt16:
1639-
case NI_Vector64_AsInt32:
1640-
case NI_Vector64_AsInt64:
1641-
case NI_Vector64_AsNInt:
1642-
case NI_Vector64_AsNUInt:
1643-
case NI_Vector64_AsSByte:
1644-
case NI_Vector64_AsSingle:
1645-
case NI_Vector64_AsUInt16:
1646-
case NI_Vector64_AsUInt32:
1647-
case NI_Vector64_AsUInt64:
1648-
case NI_Vector64_op_UnaryPlus:
1649-
#endif // TARGET_XARCH
1650-
case NI_Vector128_As:
1651-
case NI_Vector128_AsByte:
1652-
case NI_Vector128_AsDouble:
1653-
case NI_Vector128_AsInt16:
1654-
case NI_Vector128_AsInt32:
1655-
case NI_Vector128_AsInt64:
1656-
case NI_Vector128_AsNInt:
1657-
case NI_Vector128_AsNUInt:
1658-
case NI_Vector128_AsSByte:
1659-
case NI_Vector128_AsSingle:
1660-
case NI_Vector128_AsUInt16:
1661-
case NI_Vector128_AsUInt32:
1662-
case NI_Vector128_AsUInt64:
1663-
case NI_Vector128_AsVector4:
1664-
case NI_Vector128_op_UnaryPlus:
1665-
case NI_VectorT_As:
1666-
case NI_VectorT_AsVectorByte:
1667-
case NI_VectorT_AsVectorDouble:
1668-
case NI_VectorT_AsVectorInt16:
1669-
case NI_VectorT_AsVectorInt32:
1670-
case NI_VectorT_AsVectorInt64:
1671-
case NI_VectorT_AsVectorNInt:
1672-
case NI_VectorT_AsVectorNUInt:
1673-
case NI_VectorT_AsVectorSByte:
1674-
case NI_VectorT_AsVectorSingle:
1675-
case NI_VectorT_AsVectorUInt16:
1676-
case NI_VectorT_AsVectorUInt32:
1677-
case NI_VectorT_AsVectorUInt64:
1678-
case NI_VectorT_op_UnaryPlus:
1679-
#if defined(TARGET_XARCH)
1680-
case NI_Vector256_As:
1681-
case NI_Vector256_AsByte:
1682-
case NI_Vector256_AsDouble:
1683-
case NI_Vector256_AsInt16:
1684-
case NI_Vector256_AsInt32:
1685-
case NI_Vector256_AsInt64:
1686-
case NI_Vector256_AsNInt:
1687-
case NI_Vector256_AsNUInt:
1688-
case NI_Vector256_AsSByte:
1689-
case NI_Vector256_AsSingle:
1690-
case NI_Vector256_AsUInt16:
1691-
case NI_Vector256_AsUInt32:
1692-
case NI_Vector256_AsUInt64:
1693-
case NI_Vector256_op_UnaryPlus:
1694-
case NI_Vector512_As:
1695-
case NI_Vector512_AsByte:
1696-
case NI_Vector512_AsDouble:
1697-
case NI_Vector512_AsInt16:
1698-
case NI_Vector512_AsInt32:
1699-
case NI_Vector512_AsInt64:
1700-
case NI_Vector512_AsNInt:
1701-
case NI_Vector512_AsNUInt:
1702-
case NI_Vector512_AsSByte:
1703-
case NI_Vector512_AsSingle:
1704-
case NI_Vector512_AsUInt16:
1705-
case NI_Vector512_AsUInt32:
1706-
case NI_Vector512_AsUInt64:
1707-
#endif // TARGET_XARCH
1708-
#endif // FEATURE_HW_INTRINSICS
17091629
case NI_SRCS_UNSAFE_As:
17101630
case NI_SRCS_UNSAFE_AsRef:
17111631
case NI_SRCS_UNSAFE_BitCast:
@@ -1724,27 +1644,16 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed
17241644
#if defined(TARGET_ARM64)
17251645
case NI_Vector64_get_AllBitsSet:
17261646
case NI_Vector64_get_One:
1727-
case NI_Vector64_get_Zero:
17281647
#endif // TARGET_ARM64
1729-
case NI_Vector2_get_One:
1730-
case NI_Vector2_get_Zero:
1731-
case NI_Vector3_get_One:
1732-
case NI_Vector3_get_Zero:
1733-
case NI_Vector4_get_One:
1734-
case NI_Vector4_get_Zero:
17351648
case NI_Vector128_get_AllBitsSet:
17361649
case NI_Vector128_get_One:
1737-
case NI_Vector128_get_Zero:
17381650
case NI_VectorT_get_AllBitsSet:
17391651
case NI_VectorT_get_One:
1740-
case NI_VectorT_get_Zero:
17411652
#if defined(TARGET_XARCH)
17421653
case NI_Vector256_get_AllBitsSet:
17431654
case NI_Vector256_get_One:
1744-
case NI_Vector256_get_Zero:
17451655
case NI_Vector512_get_AllBitsSet:
17461656
case NI_Vector512_get_One:
1747-
case NI_Vector512_get_Zero:
17481657
#endif // TARGET_XARCH
17491658
#endif // FEATURE_HW_INTRINSICS
17501659
{

src/coreclr/jit/hwintrinsicarm64.cpp

-73
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
543543
break;
544544
}
545545

546-
case NI_Vector64_Add:
547-
case NI_Vector128_Add:
548546
case NI_Vector64_op_Addition:
549547
case NI_Vector128_op_Addition:
550548
{
@@ -569,34 +567,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
569567
break;
570568
}
571569

572-
case NI_Vector64_As:
573-
case NI_Vector64_AsByte:
574-
case NI_Vector64_AsDouble:
575-
case NI_Vector64_AsInt16:
576-
case NI_Vector64_AsInt32:
577-
case NI_Vector64_AsInt64:
578-
case NI_Vector64_AsNInt:
579-
case NI_Vector64_AsNUInt:
580-
case NI_Vector64_AsSByte:
581-
case NI_Vector64_AsSingle:
582-
case NI_Vector64_AsUInt16:
583-
case NI_Vector64_AsUInt32:
584-
case NI_Vector64_AsUInt64:
585-
case NI_Vector128_As:
586-
case NI_Vector128_AsByte:
587-
case NI_Vector128_AsDouble:
588-
case NI_Vector128_AsInt16:
589-
case NI_Vector128_AsInt32:
590-
case NI_Vector128_AsInt64:
591-
case NI_Vector128_AsNInt:
592-
case NI_Vector128_AsNUInt:
593-
case NI_Vector128_AsSByte:
594-
case NI_Vector128_AsSingle:
595-
case NI_Vector128_AsUInt16:
596-
case NI_Vector128_AsUInt32:
597-
case NI_Vector128_AsUInt64:
598570
case NI_Vector128_AsVector:
599-
case NI_Vector128_AsVector4:
600571
{
601572
assert(!sig->hasThis());
602573
assert(numArgs == 1);
@@ -711,8 +682,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
711682
break;
712683
}
713684

714-
case NI_Vector64_BitwiseAnd:
715-
case NI_Vector128_BitwiseAnd:
716685
case NI_Vector64_op_BitwiseAnd:
717686
case NI_Vector128_op_BitwiseAnd:
718687
{
@@ -725,8 +694,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
725694
break;
726695
}
727696

728-
case NI_Vector64_BitwiseOr:
729-
case NI_Vector128_BitwiseOr:
730697
case NI_Vector64_op_BitwiseOr:
731698
case NI_Vector128_op_BitwiseOr:
732699
{
@@ -1095,8 +1062,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
10951062
break;
10961063
}
10971064

1098-
case NI_Vector64_Divide:
1099-
case NI_Vector128_Divide:
11001065
case NI_Vector64_op_Division:
11011066
case NI_Vector128_op_Division:
11021067
{
@@ -1153,8 +1118,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
11531118
break;
11541119
}
11551120

1156-
case NI_Vector64_EqualsAll:
1157-
case NI_Vector128_EqualsAll:
11581121
case NI_Vector64_op_Equality:
11591122
case NI_Vector128_op_Equality:
11601123
{
@@ -1400,14 +1363,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
14001363
break;
14011364
}
14021365

1403-
case NI_Vector64_get_Zero:
1404-
case NI_Vector128_get_Zero:
1405-
{
1406-
assert(sig->numArgs == 0);
1407-
retNode = gtNewZeroConNode(retType);
1408-
break;
1409-
}
1410-
14111366
case NI_Vector64_GetElement:
14121367
case NI_Vector128_GetElement:
14131368
{
@@ -1593,8 +1548,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
15931548

15941549
case NI_AdvSimd_LoadVector64:
15951550
case NI_AdvSimd_LoadVector128:
1596-
case NI_Vector64_Load:
1597-
case NI_Vector128_Load:
15981551
case NI_Vector64_LoadUnsafe:
15991552
case NI_Vector128_LoadUnsafe:
16001553
{
@@ -1700,8 +1653,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
17001653
break;
17011654
}
17021655

1703-
case NI_Vector64_Multiply:
1704-
case NI_Vector128_Multiply:
17051656
case NI_Vector64_op_Multiply:
17061657
case NI_Vector128_op_Multiply:
17071658
{
@@ -1765,8 +1716,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
17651716
break;
17661717
}
17671718

1768-
case NI_Vector64_Negate:
1769-
case NI_Vector128_Negate:
17701719
case NI_Vector64_op_UnaryNegation:
17711720
case NI_Vector128_op_UnaryNegation:
17721721
{
@@ -1776,8 +1725,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
17761725
break;
17771726
}
17781727

1779-
case NI_Vector64_OnesComplement:
1780-
case NI_Vector128_OnesComplement:
17811728
case NI_Vector64_op_OnesComplement:
17821729
case NI_Vector128_op_OnesComplement:
17831730
{
@@ -1800,16 +1747,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
18001747
break;
18011748
}
18021749

1803-
case NI_Vector64_op_UnaryPlus:
1804-
case NI_Vector128_op_UnaryPlus:
1805-
{
1806-
assert(sig->numArgs == 1);
1807-
retNode = impSIMDPopStack();
1808-
break;
1809-
}
1810-
1811-
case NI_Vector64_Subtract:
1812-
case NI_Vector128_Subtract:
18131750
case NI_Vector64_op_Subtraction:
18141751
case NI_Vector128_op_Subtraction:
18151752
{
@@ -1822,8 +1759,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
18221759
break;
18231760
}
18241761

1825-
case NI_Vector64_ShiftLeft:
1826-
case NI_Vector128_ShiftLeft:
18271762
case NI_Vector64_op_LeftShift:
18281763
case NI_Vector128_op_LeftShift:
18291764
{
@@ -1836,8 +1771,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
18361771
break;
18371772
}
18381773

1839-
case NI_Vector64_ShiftRightArithmetic:
1840-
case NI_Vector128_ShiftRightArithmetic:
18411774
case NI_Vector64_op_RightShift:
18421775
case NI_Vector128_op_RightShift:
18431776
{
@@ -1851,8 +1784,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
18511784
break;
18521785
}
18531786

1854-
case NI_Vector64_ShiftRightLogical:
1855-
case NI_Vector128_ShiftRightLogical:
18561787
case NI_Vector64_op_UnsignedRightShift:
18571788
case NI_Vector128_op_UnsignedRightShift:
18581789
{
@@ -1936,9 +1867,7 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
19361867
break;
19371868
}
19381869

1939-
case NI_Vector64_Store:
19401870
case NI_Vector64_StoreUnsafe:
1941-
case NI_Vector128_Store:
19421871
case NI_Vector128_StoreUnsafe:
19431872
{
19441873
assert(retType == TYP_VOID);
@@ -2276,8 +2205,6 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
22762205
break;
22772206
}
22782207

2279-
case NI_Vector64_Xor:
2280-
case NI_Vector128_Xor:
22812208
case NI_Vector64_op_ExclusiveOr:
22822209
case NI_Vector128_op_ExclusiveOr:
22832210
{

0 commit comments

Comments
 (0)