- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Description
Rationale
Today, the runtime supports the __fastcall calling convention, which not only allows interop with any native code that uses that calling convention but also allows it to take advantage of the additional registers that are available on the underlying architecture.
However, it means that operating with certain data types is still "sub-optimal".
Microsoft Windows provides the __vectorcall calling convention just for this purpose (https://msdn.microsoft.com/en-us/library/dn375768.aspx). It extends the existing __fastcall calling convention to additionally allow SIMD vector types and Homogeneous Vector Aggregate values to be passed via register rather than on the stack.
The System V AMD64 ABI already defines vector sized types (__m128, __m256) and supports passing them in register.
Proposal
The runtime should add support for the __vectorcall calling convention, not only to improve performance, but to also provide better interop with native code that uses it.
namespace System.Runtime.CompilerServices
{
+    public class CallConvVectorCall
+    {
+        // This type has no members and is identical in structure to other `CallConv*` types
+    }
}Alternative API proposal
The __vectorcall calling convention could be exposed on System.Runtime.InteropServices.CallingConvention as VectorCall.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status