From 1bc624a7489e97b7be271210e964b59fa41c0049 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 7 Sep 2016 16:55:12 +0000 Subject: [PATCH] Add MS __nop intrinsic to intrin.h Summary: There was no definition for __nop function - added inline assembly. Patch by Albert Gutowski! Reviewers: rnk, thakis Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D24286 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280826 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/intrin.h | 5 +++++ test/Headers/ms-intrin.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/Headers/intrin.h b/lib/Headers/intrin.h index 268ac4a17b..d68fdfc7a3 100644 --- a/lib/Headers/intrin.h +++ b/lib/Headers/intrin.h @@ -97,6 +97,7 @@ static __inline__ void __movsd(unsigned long *, unsigned long const *, size_t); static __inline__ void __movsw(unsigned short *, unsigned short const *, size_t); +static __inline__ void __nop(void); void __nvreg_restore_fence(void); void __nvreg_save_fence(void); @@ -918,6 +919,10 @@ static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile ("hlt"); } +static __inline__ void __DEFAULT_FN_ATTRS +__nop(void) { + __asm__ volatile ("nop"); +} #endif /*----------------------------------------------------------------------------*\ diff --git a/test/Headers/ms-intrin.cpp b/test/Headers/ms-intrin.cpp index 25c5531c41..4d6803a081 100644 --- a/test/Headers/ms-intrin.cpp +++ b/test/Headers/ms-intrin.cpp @@ -52,6 +52,7 @@ void f() { __cpuidex(info, 0, 0); _xgetbv(0); __halt(); + __nop(); __readmsr(0); // FIXME: Call these in 64-bit too once the intrinsics have been fixed to -- 2.40.0