2013-09-21 05:12:25 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu pentium4 \
|
2014-07-16 11:13:50 +08:00
|
|
|
// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
|
2014-01-29 07:01:59 +08:00
|
|
|
// RUN: -ffreestanding -fsyntax-only -Werror \
|
|
|
|
// RUN: -isystem %S/Inputs/include %s
|
2013-09-19 08:19:53 +08:00
|
|
|
|
2014-11-03 12:19:58 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-win32 -target-cpu broadwell \
|
|
|
|
// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
|
2015-09-22 08:46:21 +08:00
|
|
|
// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
|
2014-11-03 12:19:58 +08:00
|
|
|
// RUN: -isystem %S/Inputs/include %s
|
|
|
|
|
2014-03-13 05:09:03 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-pc-win32 \
|
2014-07-16 11:13:50 +08:00
|
|
|
// RUN: -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
|
2015-09-22 08:46:21 +08:00
|
|
|
// RUN: -ffreestanding -emit-obj -o /dev/null -Werror \
|
2014-03-13 05:09:03 +08:00
|
|
|
// RUN: -isystem %S/Inputs/include %s
|
|
|
|
|
2014-07-09 04:21:29 +08:00
|
|
|
// RUN: %clang_cc1 -triple thumbv7--windows \
|
2014-07-16 11:13:50 +08:00
|
|
|
// RUN: -fms-compatibility -fms-compatibility-version=17.00 \
|
|
|
|
// RUN: -ffreestanding -fsyntax-only -Werror \
|
2014-07-09 04:21:29 +08:00
|
|
|
// RUN: -isystem %S/Inputs/include %s
|
|
|
|
|
2015-09-23 08:24:34 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
|
|
|
|
2016-06-15 04:14:24 +08:00
|
|
|
// intrin.h needs size_t, but -ffreestanding prevents us from getting it from
|
2013-09-19 09:54:40 +08:00
|
|
|
// stddef.h. Work around it with this typedef.
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
2013-09-19 08:32:11 +08:00
|
|
|
|
2016-06-15 04:14:24 +08:00
|
|
|
#include <intrin.h>
|
2013-09-19 08:19:53 +08:00
|
|
|
|
2013-09-19 09:54:40 +08:00
|
|
|
// Use some C++ to make sure we closed the extern "C" brackets.
|
2013-09-19 08:19:53 +08:00
|
|
|
template <typename T>
|
|
|
|
void foo(T V) {}
|
2015-09-22 08:46:21 +08:00
|
|
|
|
|
|
|
// __asm__ blocks are only checked for inline functions that end up being
|
|
|
|
// emitted, so call functions with __asm__ blocks to make sure their inline
|
|
|
|
// assembly parses.
|
|
|
|
void f() {
|
|
|
|
__movsb(0, 0, 0);
|
|
|
|
__movsd(0, 0, 0);
|
|
|
|
__movsw(0, 0, 0);
|
|
|
|
|
|
|
|
__stosd(0, 0, 0);
|
|
|
|
__stosw(0, 0, 0);
|
|
|
|
|
|
|
|
#ifdef _M_X64
|
|
|
|
__movsq(0, 0, 0);
|
|
|
|
__stosq(0, 0, 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int info[4];
|
|
|
|
__cpuid(info, 0);
|
|
|
|
__cpuidex(info, 0, 0);
|
2019-01-17 06:56:25 +08:00
|
|
|
#if defined(_M_X64) || defined(_M_IX86)
|
2016-08-17 00:04:14 +08:00
|
|
|
_xgetbv(0);
|
2019-01-17 06:56:25 +08:00
|
|
|
#endif
|
2015-09-22 08:46:21 +08:00
|
|
|
__halt();
|
2016-09-08 00:55:12 +08:00
|
|
|
__nop();
|
2015-09-22 08:46:21 +08:00
|
|
|
__readmsr(0);
|
|
|
|
|
|
|
|
// FIXME: Call these in 64-bit too once the intrinsics have been fixed to
|
2015-09-22 08:51:10 +08:00
|
|
|
// work there, PR19301
|
2015-09-22 08:46:21 +08:00
|
|
|
#ifndef _M_X64
|
|
|
|
__readcr3();
|
|
|
|
__writecr3(0);
|
|
|
|
#endif
|
2016-08-07 01:58:24 +08:00
|
|
|
|
|
|
|
#ifdef _M_ARM
|
|
|
|
__dmb(_ARM_BARRIER_ISHST);
|
|
|
|
#endif
|
2017-07-28 03:45:13 +08:00
|
|
|
|
|
|
|
#ifdef _M_ARM64
|
|
|
|
__dmb(_ARM64_BARRIER_SY);
|
|
|
|
#endif
|
2015-09-22 08:46:21 +08:00
|
|
|
}
|