[PATCH] D24286: Add MS __nop intrinsic to intrin.h

Albert Gutowski via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 17:10:08 PDT 2016


agutowski created this revision.
agutowski added reviewers: rnk, thakis.
agutowski added a subscriber: cfe-commits.

There was no definition for __nop function - added inline assembly.

https://reviews.llvm.org/D24286

Files:
  lib/Headers/intrin.h
  test/Headers/ms-intrin.cpp

Index: lib/Headers/intrin.h
===================================================================
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -97,6 +97,7 @@
 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 @@
 __halt(void) {
   __asm__ volatile ("hlt");
 }
+static __inline__ void __DEFAULT_FN_ATTRS
+__nop(void) {
+  __asm__ volatile ("nop");
+}
 #endif
 
 /*----------------------------------------------------------------------------*\
Index: test/Headers/ms-intrin.cpp
===================================================================
--- test/Headers/ms-intrin.cpp
+++ test/Headers/ms-intrin.cpp
@@ -52,6 +52,7 @@
   __cpuidex(info, 0, 0);
   _xgetbv(0);
   __halt();
+  __nop();
   __readmsr(0);
 
   // FIXME: Call these in 64-bit too once the intrinsics have been fixed to


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24286.70495.patch
Type: text/x-patch
Size: 1011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160907/18866d1b/attachment.bin>


More information about the cfe-commits mailing list