From a39010fbaf75b7f040c169e1ca858757da6b9ad8 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 5 Nov 2021 11:38:29 -0700 Subject: [PATCH] Updating src/tests/Interop/PInvoke/Generics/GenericsNative.Vector* to annotate individual methods as requiring AVX --- src/tests/Common/Platform/platformdefines.h | 6 ++++++ .../PInvoke/Generics/GenericsNative.Vector256D.cpp | 10 +++++----- .../PInvoke/Generics/GenericsNative.Vector256F.cpp | 10 +++++----- .../PInvoke/Generics/GenericsNative.Vector256U.cpp | 10 +++++----- .../PInvoke/Generics/GenericsNative.VectorD.cpp | 10 +++++----- .../PInvoke/Generics/GenericsNative.VectorL.cpp | 10 +++++----- .../PInvoke/Generics/GenericsNative.VectorU.cpp | 10 +++++----- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/tests/Common/Platform/platformdefines.h b/src/tests/Common/Platform/platformdefines.h index 35781efa844..c5e61c58400 100644 --- a/src/tests/Common/Platform/platformdefines.h +++ b/src/tests/Common/Platform/platformdefines.h @@ -270,5 +270,11 @@ inline void CoreClrFree(void *p) #define strcpy_s TP_strcpy_s #endif +#if defined(TARGET_XARCH) && !defined(_MSC_VER) +#define ENABLE_AVX __attribute__ ((target("avx"))) +#else +#define ENABLE_AVX +#endif + #endif diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp index 769004e10cb..0e02e4a1bd2 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp @@ -27,7 +27,7 @@ static Vector256D Vector256DValue = { }; -extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE GetVector256D(double e00, double e01, double e02, double e03) +extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE ENABLE_AVX GetVector256D(double e00, double e01, double e02, double e03) { union { double value[4]; @@ -42,7 +42,7 @@ extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE GetVector256D(double e00, dou return result; } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256DOut(double e00, double e01, double e02, double e03, Vector256D* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVector256DOut(double e00, double e01, double e02, double e03, Vector256D* pValue) { Vector256D value = GetVector256D(e00, e01, e02, e03); @@ -54,18 +54,18 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256DOut(double e00, double #endif } -extern "C" DLL_EXPORT const Vector256D* STDMETHODCALLTYPE GetVector256DPtr(double e00, double e01, double e02, double e03) +extern "C" DLL_EXPORT const Vector256D* STDMETHODCALLTYPE ENABLE_AVX GetVector256DPtr(double e00, double e01, double e02, double e03) { GetVector256DOut(e00, e01, e02, e03, &Vector256DValue); return &Vector256DValue; } -extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE AddVector256D(Vector256D lhs, Vector256D rhs) +extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE ENABLE_AVX AddVector256D(Vector256D lhs, Vector256D rhs) { throw "P/Invoke for Vector256 should be unsupported."; } -extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE AddVector256Ds(const Vector256D* pValues, uint32_t count) +extern "C" DLL_EXPORT Vector256D STDMETHODCALLTYPE ENABLE_AVX AddVector256Ds(const Vector256D* pValues, uint32_t count) { throw "P/Invoke for Vector256 should be unsupported."; } diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp index c261ca25ab7..456d4cad18b 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp @@ -31,7 +31,7 @@ static Vector256F Vector256FValue = { }; -extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE GetVector256F(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07) +extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE ENABLE_AVX GetVector256F(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07) { union { float value[8]; @@ -50,7 +50,7 @@ extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE GetVector256F(float e00, floa return result; } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256FOut(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07, Vector256F* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVector256FOut(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07, Vector256F* pValue) { Vector256F value = GetVector256F(e00, e01, e02, e03, e04, e05, e06, e07); @@ -62,18 +62,18 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256FOut(float e00, float e #endif } -extern "C" DLL_EXPORT const Vector256F* STDMETHODCALLTYPE GetVector256FPtr(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07) +extern "C" DLL_EXPORT const Vector256F* STDMETHODCALLTYPE ENABLE_AVX GetVector256FPtr(float e00, float e01, float e02, float e03, float e04, float e05, float e06, float e07) { GetVector256FOut(e00, e01, e02, e03, e04, e05, e06, e07, &Vector256FValue); return &Vector256FValue; } -extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE AddVector256F(Vector256F lhs, Vector256F rhs) +extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE ENABLE_AVX AddVector256F(Vector256F lhs, Vector256F rhs) { throw "P/Invoke for Vector256 should be unsupported."; } -extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE AddVector256Fs(const Vector256F* pValues, uint32_t count) +extern "C" DLL_EXPORT Vector256F STDMETHODCALLTYPE ENABLE_AVX AddVector256Fs(const Vector256F* pValues, uint32_t count) { throw "P/Invoke for Vector256 should be unsupported."; } diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp index 99fe029d3ee..a28f772b277 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp @@ -31,7 +31,7 @@ static Vector256U Vector256UValue = { }; -extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE GetVector256U(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) +extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE ENABLE_AVX GetVector256U(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) { union { uint32_t value[8]; @@ -50,7 +50,7 @@ extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE GetVector256U(uint32_t e00, u return result; } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256UOut(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07, Vector256U* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVector256UOut(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07, Vector256U* pValue) { Vector256U value = GetVector256U(e00, e01, e02, e03, e04, e05, e06, e07); @@ -62,18 +62,18 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVector256UOut(uint32_t e00, uint #endif } -extern "C" DLL_EXPORT const Vector256U* STDMETHODCALLTYPE GetVector256UPtr(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) +extern "C" DLL_EXPORT const Vector256U* STDMETHODCALLTYPE ENABLE_AVX GetVector256UPtr(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) { GetVector256UOut(e00, e01, e02, e03, e04, e05, e06, e07, &Vector256UValue); return &Vector256UValue; } -extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE AddVector256U(Vector256U lhs, Vector256U rhs) +extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE ENABLE_AVX AddVector256U(Vector256U lhs, Vector256U rhs) { throw "P/Invoke for Vector256 should be unsupported."; } -extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE AddVector256Us(const Vector256U* pValues, uint32_t count) +extern "C" DLL_EXPORT Vector256U STDMETHODCALLTYPE ENABLE_AVX AddVector256Us(const Vector256U* pValues, uint32_t count) { throw "P/Invoke for Vector256 should be unsupported."; } diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorD.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorD.cpp index 3c7be41dd0c..a870ee55ba1 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorD.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorD.cpp @@ -27,7 +27,7 @@ extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE GetVectorD128(double e00, dou return *reinterpret_cast(value); } -extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE GetVectorD256(double e00, double e01, double e02, double e03) +extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX GetVectorD256(double e00, double e01, double e02, double e03) { double value[4] = { e00, e01, e02, e03 }; return *reinterpret_cast(value); @@ -38,7 +38,7 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorD128Out(double e00, double *pValue = GetVectorD128(e00, e01); } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorD256Out(double e00, double e01, double e02, double e03, VectorD256* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVectorD256Out(double e00, double e01, double e02, double e03, VectorD256* pValue) { *pValue = GetVectorD256(e00, e01, e02, e03); } @@ -49,7 +49,7 @@ extern "C" DLL_EXPORT const VectorD128* STDMETHODCALLTYPE GetVectorD128Ptr(doubl return &VectorD128Value; } -extern "C" DLL_EXPORT const VectorD256* STDMETHODCALLTYPE GetVectorD256Ptr(double e00, double e01, double e02, double e03) +extern "C" DLL_EXPORT const VectorD256* STDMETHODCALLTYPE ENABLE_AVX GetVectorD256Ptr(double e00, double e01, double e02, double e03) { GetVectorD256Out(e00, e01, e02, e03, &VectorD256Value); return &VectorD256Value; @@ -60,7 +60,7 @@ extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE AddVectorD128(VectorD128 lhs, throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE AddVectorD256(VectorD256 lhs, VectorD256 rhs) +extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX AddVectorD256(VectorD256 lhs, VectorD256 rhs) { throw "P/Invoke for Vector should be unsupported."; } @@ -70,7 +70,7 @@ extern "C" DLL_EXPORT VectorD128 STDMETHODCALLTYPE AddVectorD128s(const VectorD1 throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE AddVectorD256s(const VectorD256* pValues, double count) +extern "C" DLL_EXPORT VectorD256 STDMETHODCALLTYPE ENABLE_AVX AddVectorD256s(const VectorD256* pValues, double count) { throw "P/Invoke for Vector should be unsupported."; } diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorL.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorL.cpp index d3b2ea40fce..a7f6ec540e3 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorL.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorL.cpp @@ -27,7 +27,7 @@ extern "C" DLL_EXPORT VectorL128 STDMETHODCALLTYPE GetVectorL128(int64_t e00, in return *reinterpret_cast(value); } -extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE GetVectorL256(int64_t e00, int64_t e01, int64_t e02, int64_t e03) +extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE ENABLE_AVX GetVectorL256(int64_t e00, int64_t e01, int64_t e02, int64_t e03) { int64_t value[4] = { e00, e01, e02, e03 }; return *reinterpret_cast(value); @@ -38,7 +38,7 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorL128Out(int64_t e00, int64 *pValue = GetVectorL128(e00, e01); } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorL256Out(int64_t e00, int64_t e01, int64_t e02, int64_t e03, VectorL256* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVectorL256Out(int64_t e00, int64_t e01, int64_t e02, int64_t e03, VectorL256* pValue) { *pValue = GetVectorL256(e00, e01, e02, e03); } @@ -49,7 +49,7 @@ extern "C" DLL_EXPORT const VectorL128* STDMETHODCALLTYPE GetVectorL128Ptr(int64 return &VectorL128Value; } -extern "C" DLL_EXPORT const VectorL256* STDMETHODCALLTYPE GetVectorL256Ptr(int64_t e00, int64_t e01, int64_t e02, int64_t e03) +extern "C" DLL_EXPORT const VectorL256* STDMETHODCALLTYPE ENABLE_AVX GetVectorL256Ptr(int64_t e00, int64_t e01, int64_t e02, int64_t e03) { GetVectorL256Out(e00, e01, e02, e03, &VectorL256Value); return &VectorL256Value; @@ -60,7 +60,7 @@ extern "C" DLL_EXPORT VectorL128 STDMETHODCALLTYPE AddVectorL128(VectorL128 lhs, throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE AddVectorL256(VectorL256 lhs, VectorL256 rhs) +extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE ENABLE_AVX AddVectorL256(VectorL256 lhs, VectorL256 rhs) { throw "P/Invoke for Vector should be unsupported."; } @@ -70,7 +70,7 @@ extern "C" DLL_EXPORT VectorL128 STDMETHODCALLTYPE AddVectorL128s(const VectorL1 throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE AddVectorL256s(const VectorL256* pValues, int64_t count) +extern "C" DLL_EXPORT VectorL256 STDMETHODCALLTYPE ENABLE_AVX AddVectorL256s(const VectorL256* pValues, int64_t count) { throw "P/Invoke for Vector should be unsupported."; } diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorU.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorU.cpp index c125f6de4ce..246801c25d0 100644 --- a/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorU.cpp +++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.VectorU.cpp @@ -33,7 +33,7 @@ extern "C" DLL_EXPORT VectorU128 STDMETHODCALLTYPE GetVectorU128(uint32_t e00, u return *reinterpret_cast(value); } -extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE GetVectorU256(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) +extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE ENABLE_AVX GetVectorU256(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) { uint32_t value[8] = { e00, e01, e02, e03, e04, e05, e06, e07 }; return *reinterpret_cast(value); @@ -44,7 +44,7 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorU128Out(uint32_t e00, uint *pValue = GetVectorU128(e00, e01, e02, e03); } -extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetVectorU256Out(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07, VectorU256* pValue) +extern "C" DLL_EXPORT void STDMETHODCALLTYPE ENABLE_AVX GetVectorU256Out(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07, VectorU256* pValue) { *pValue = GetVectorU256(e00, e01, e02, e03, e04, e05, e06, e07); } @@ -55,7 +55,7 @@ extern "C" DLL_EXPORT const VectorU128* STDMETHODCALLTYPE GetVectorU128Ptr(uint3 return &VectorU128Value; } -extern "C" DLL_EXPORT const VectorU256* STDMETHODCALLTYPE GetVectorU256Ptr(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) +extern "C" DLL_EXPORT const VectorU256* STDMETHODCALLTYPE ENABLE_AVX GetVectorU256Ptr(uint32_t e00, uint32_t e01, uint32_t e02, uint32_t e03, uint32_t e04, uint32_t e05, uint32_t e06, uint32_t e07) { GetVectorU256Out(e00, e01, e02, e03, e04, e05, e06, e07, &VectorU256Value); return &VectorU256Value; @@ -66,7 +66,7 @@ extern "C" DLL_EXPORT VectorU128 STDMETHODCALLTYPE AddVectorU128(VectorU128 lhs, throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE AddVectorU256(VectorU256 lhs, VectorU256 rhs) +extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE ENABLE_AVX AddVectorU256(VectorU256 lhs, VectorU256 rhs) { throw "P/Invoke for Vector should be unsupported."; } @@ -76,7 +76,7 @@ extern "C" DLL_EXPORT VectorU128 STDMETHODCALLTYPE AddVectorU128s(const VectorU1 throw "P/Invoke for Vector should be unsupported."; } -extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE AddVectorU256s(const VectorU256* pValues, uint32_t count) +extern "C" DLL_EXPORT VectorU256 STDMETHODCALLTYPE ENABLE_AVX AddVectorU256s(const VectorU256* pValues, uint32_t count) { throw "P/Invoke for Vector should be unsupported."; } -- 2.33.1.windows.1