From 3f7788e08185c867508d35c4461f9a3a6af5ddf5 Mon Sep 17 00:00:00 2001 From: Harry Gillanders Date: Sun, 21 Apr 2024 12:02:36 +0100 Subject: [PATCH] Add a test for checking that MSVC intrinsics are actually available from C. --- compiler/test/compilable/msvc_intrinsics.c | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 compiler/test/compilable/msvc_intrinsics.c diff --git a/compiler/test/compilable/msvc_intrinsics.c b/compiler/test/compilable/msvc_intrinsics.c new file mode 100644 index 000000000000..583b7f7ae5d7 --- /dev/null +++ b/compiler/test/compilable/msvc_intrinsics.c @@ -0,0 +1,31 @@ +// LINK: +// REQUIRED_ARGS: -os=windows +// PERMUTE_ARGS: -i -betterC +// Checking that the MSVC intrinsics reimplemented for ImportC are actually available from C. + +#if defined(_M_AMD64) +unsigned long long multiplyU128(unsigned long long a, unsigned long long b, unsigned long long* high) +{ + return _umul128(a, b, high); +} +#elif defined(_M_IX86) +int interlockedAddLarge(long long *target, int value) +{ + return _InterlockedAddLargeStatistic(target, value); +} +#elif defined(_M_ARM64) +unsigned long long multiplyUHigh64(unsigned long long a, unsigned long long b) +{ + return __umulh(a, b); +} +#elif defined(_M_ARM) +void dmb(void) +{ + __dmb(11); +} +#endif + +int main(void) +{ + return 0; +}