Skip to content

Commit

Permalink
Add a test for checking that MSVC intrinsics are actually available f…
Browse files Browse the repository at this point in the history
…rom C.
  • Loading branch information
just-harry committed Apr 21, 2024
1 parent c705ee2 commit 3f7788e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions compiler/test/compilable/msvc_intrinsics.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 3f7788e

Please sign in to comment.