-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
GenericsNative.Vector64D.cpp
72 lines (58 loc) · 1.7 KB
/
GenericsNative.Vector64D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include <stdio.h>
#include <stdint.h>
#include <xplatform.h>
#include <platformdefines.h>
#if defined(TARGET_XARCH)
#include <mmintrin.h>
typedef __m64 Vector64D;
#elif defined(TARGET_ARMARCH)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
typedef __n64 float64x1_t;
#elif defined(TARGET_ARM64)
#include <arm_neon.h>
#else
typedef struct {
double e00;
} float64x1_t;
#endif
typedef float64x1_t Vector64D;
#else
#error Unsupported target architecture
#endif
static Vector64D Vector64DValue = { };
extern "C" DLL_EXPORT Vector64D STDMETHODCALLTYPE GetVector64D(double e00)
{
union {
double value[1];
Vector64D result;
};
value[0] = e00;
return result;
}
extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector64DOut(double e00, Vector64D* pValue)
{
*pValue = GetVector64D(e00);
#if defined(_MSC_VER) && defined(TARGET_X86)
_mm_empty();
#endif // _MSC_VER && TARGET_X86
}
extern "C" DLL_EXPORT const Vector64D* STDMETHODCALLTYPE GetVector64DPtr(double e00)
{
GetVector64DOut(e00, &Vector64DValue);
return &Vector64DValue;
}
extern "C" DLL_EXPORT Vector64D STDMETHODCALLTYPE AddVector64D(Vector64D lhs, Vector64D rhs)
{
throw "P/Invoke for Vector64<double> should be unsupported.";
}
extern "C" DLL_EXPORT Vector64D STDMETHODCALLTYPE AddVector64Ds(const Vector64D* pValues, uint32_t count)
{
throw "P/Invoke for Vector64<double> should be unsupported.";
}