| 1 | // RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu pentium4 \ |
| 2 | // RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 3 | // RUN: -ffreestanding -fsyntax-only -Werror \ |
| 4 | // RUN: -isystem %S/Inputs/include %s |
| 5 | |
| 6 | // RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu broadwell \ |
| 7 | // RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 8 | // RUN: -ffreestanding -emit-obj -o /dev/null -Werror \ |
| 9 | // RUN: -isystem %S/Inputs/include %s |
| 10 | |
| 11 | // RUN: %clang_cc1 -triple x86_64-pc-win32 \ |
| 12 | // RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ |
| 13 | // RUN: -ffreestanding -emit-obj -o /dev/null -Werror \ |
| 14 | // RUN: -isystem %S/Inputs/include %s |
| 15 | |
| 16 | // RUN: %clang_cc1 -triple thumbv7--windows \ |
| 17 | // RUN: -fms-compatibility -fms-compatibility-version=17.00 \ |
| 18 | // RUN: -ffreestanding -fsyntax-only -Werror \ |
| 19 | // RUN: -isystem %S/Inputs/include %s |
| 20 | |
| 21 | // REQUIRES: x86-registered-target |
| 22 | |
| 23 | // intrin.h needs size_t, but -ffreestanding prevents us from getting it from |
| 24 | // stddef.h. Work around it with this typedef. |
| 25 | typedef __SIZE_TYPE__ size_t; |
| 26 | |
| 27 | #include <intrin.h> |
| 28 | |
| 29 | // Use some C++ to make sure we closed the extern "C" brackets. |
| 30 | template <typename T> |
| 31 | void foo(T V) {} |
| 32 | |
| 33 | // __asm__ blocks are only checked for inline functions that end up being |
| 34 | // emitted, so call functions with __asm__ blocks to make sure their inline |
| 35 | // assembly parses. |
| 36 | void f() { |
| 37 | __movsb(0, 0, 0); |
| 38 | __movsd(0, 0, 0); |
| 39 | __movsw(0, 0, 0); |
| 40 | |
| 41 | __stosd(0, 0, 0); |
| 42 | __stosw(0, 0, 0); |
| 43 | |
| 44 | #ifdef _M_X64 |
| 45 | __movsq(0, 0, 0); |
| 46 | __stosq(0, 0, 0); |
| 47 | #endif |
| 48 | |
| 49 | int info[4]; |
| 50 | __cpuid(info, 0); |
| 51 | __cpuidex(info, 0, 0); |
| 52 | #if defined(_M_X64) || defined(_M_IX86) |
| 53 | _xgetbv(0); |
| 54 | #endif |
| 55 | __halt(); |
| 56 | __nop(); |
| 57 | __readmsr(0); |
| 58 | |
| 59 | // FIXME: Call these in 64-bit too once the intrinsics have been fixed to |
| 60 | // work there, PR19301 |
| 61 | #ifndef _M_X64 |
| 62 | __readcr3(); |
| 63 | __writecr3(0); |
| 64 | #endif |
| 65 | |
| 66 | #ifdef _M_ARM |
| 67 | __dmb(_ARM_BARRIER_ISHST); |
| 68 | #endif |
| 69 | |
| 70 | #ifdef _M_ARM64 |
| 71 | __dmb(_ARM64_BARRIER_SY); |
| 72 | #endif |
| 73 | } |
| 74 | |