diff --git a/src/tests/Common/Platform/platformdefines.h b/src/tests/Common/Platform/platformdefines.h
index 043aedee30e20..3be7429437f60 100644
--- a/src/tests/Common/Platform/platformdefines.h
+++ b/src/tests/Common/Platform/platformdefines.h
@@ -18,6 +18,13 @@
#define _CRT_SECURE_NO_WARNINGS 1
#endif
+#if defined(TARGET_X86) || defined(TARGET_AMD64)
+#define TARGET_XARCH
+#endif
+
+#if defined(TARGET_ARM) || defined(TARGET_ARM64)
+#define TARGET_ARMARCH
+#endif
// Ensure that both UNICODE and _UNICODE are set.
#ifndef _UNICODE
diff --git a/src/tests/Directory.Build.props b/src/tests/Directory.Build.props
index c0dcca32e0653..45d0c1ee26c87 100644
--- a/src/tests/Directory.Build.props
+++ b/src/tests/Directory.Build.props
@@ -139,6 +139,7 @@
32
64
64
+ 64
diff --git a/src/tests/Interop/PInvoke/Generics/CMakeLists.txt b/src/tests/Interop/PInvoke/Generics/CMakeLists.txt
index 67b1020d6ec96..62baff4017164 100644
--- a/src/tests/Interop/PInvoke/Generics/CMakeLists.txt
+++ b/src/tests/Interop/PInvoke/Generics/CMakeLists.txt
@@ -1,18 +1,5 @@
project (GenericsNative)
include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-if(CLR_CMAKE_TARGET_ARCH_I386)
- add_definitions(-DTARGET_X86)
- add_definitions(-DTARGET_XARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_AMD64)
- add_definitions(-DTARGET_AMD64)
- add_definitions(-DTARGET_XARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_ARM)
- add_definitions(-DTARGET_ARM)
- add_definitions(-DTARGET_ARMARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
- add_definitions(-DTARGET_ARM64)
- add_definitions(-DTARGET_ARMARCH)
-endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# The ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
add_compile_options(-Wno-psabi)
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128B.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128B.cpp
index ff2bd457895f3..97175c18a9ab3 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128B.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128B.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128i Vector128B;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128C.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128C.cpp
index f272895cde757..146cfba6927ca 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128C.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128C.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128i Vector128C;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128D.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128D.cpp
index c854833191a23..f3c7aa4b5f28a 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128D.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128D.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128d Vector128D;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128F.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128F.cpp
index ddd77d0a187bf..f5c4d237b77cc 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128F.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128F.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128 Vector128F;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128L.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128L.cpp
index a46650c186344..211249ccf8696 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128L.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128L.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128i Vector128L;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128U.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128U.cpp
index d74a1eef96f46..08c6cfc4def3b 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128U.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector128U.cpp
@@ -10,7 +10,7 @@
#include
typedef __m128i Vector128U;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256B.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256B.cpp
index 985c4116bfe28..f51ea87767ea1 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256B.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256B.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256C.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256C.cpp
index e567af1e01325..a489455f42994 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256C.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256C.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp
index abde579656f00..46d0c7d2ac72a 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256D.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp
index f941896286510..3d62cd6ed1a87 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256F.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256L.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256L.cpp
index 744c8ed6527bd..797385db5fa34 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256L.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256L.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp
index 2e3e5421a34e4..d433035d5487a 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector256U.cpp
@@ -8,7 +8,7 @@
#if defined(TARGET_XARCH)
#include
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Intentionally empty
#else
#error Unsupported target architecture
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64B.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64B.cpp
index b3a70aba36b03..8563ba4e0224d 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64B.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64B.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64B;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64C.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64C.cpp
index 54d046d3118c3..8f597d3af4682 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64C.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64C.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64C;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64D.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64D.cpp
index 3309f59a78c28..98b0519850275 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64D.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64D.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64D;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64F.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64F.cpp
index 2714f4e530e46..f4b5aad32781f 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64F.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64F.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64F;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64L.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64L.cpp
index 04effb11e2ef8..8401ce572245f 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64L.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64L.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64L;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64U.cpp b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64U.cpp
index cd1bad61e2c23..8a0f79faf2b73 100644
--- a/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64U.cpp
+++ b/src/tests/Interop/PInvoke/Generics/GenericsNative.Vector64U.cpp
@@ -10,7 +10,7 @@
#include
typedef __m64 Vector64U;
-#elif defined(TARGET_ARMARCH)
+#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
#if defined(_MSC_VER)
#if defined(TARGET_ARM64)
#include
diff --git a/src/tests/Interop/PInvoke/Int128/CMakeLists.txt b/src/tests/Interop/PInvoke/Int128/CMakeLists.txt
index 9474de8c3dcd6..17690db349b4b 100644
--- a/src/tests/Interop/PInvoke/Int128/CMakeLists.txt
+++ b/src/tests/Interop/PInvoke/Int128/CMakeLists.txt
@@ -1,18 +1,5 @@
project (Int128Native)
include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake")
-if(CLR_CMAKE_TARGET_ARCH_I386)
- add_definitions(-DTARGET_X86)
- add_definitions(-DTARGET_XARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_AMD64)
- add_definitions(-DTARGET_AMD64)
- add_definitions(-DTARGET_XARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_ARM)
- add_definitions(-DTARGET_ARM)
- add_definitions(-DTARGET_ARMARCH)
-elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
- add_definitions(-DTARGET_ARM64)
- add_definitions(-DTARGET_ARMARCH)
-endif()
set(SOURCES
Int128Native.cpp
UInt128Native.cpp
diff --git a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
index 4a74572717890..3f77f7ffac1e3 100644
--- a/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
+++ b/src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
@@ -197,7 +197,7 @@ struct OUTER3
static_assert_no_msg(sizeof(OUTER3) == 28);
#endif
#else // WINDOWS
-#if defined(__x86_64__) || defined(__aarch64__)
+#if defined(__x86_64__) || defined(__aarch64__) || defined(__loongarch64)
union OUTER3
{
struct InnerSequential arr[2];