[PATCH] D12278: [X86] Add MSVC-compatible intrinsics for clac, stac, lgdt and sgdt

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 09:52:01 PDT 2015


rnk added inline comments.

================
Comment at: lib/Headers/Intrin.h:961
@@ +960,3 @@
+static __inline__ void __DEFAULT_FN_ATTRS _lgdt(void *__ptr) {
+  __builtin_ia32_lgdt(__ptr);
+}
----------------
compnerd wrote:
> mkuper wrote:
> > compnerd wrote:
> > > Why does this need a builtin?  Is an inline assembly block using lgdt insufficient for some reason?
> > I think using a builtin is, generally, cleaner.
> > I'm ok with using inline asm (and abandoning the LLVM part of the patch), if that's the more popular option.
> Yes, that is the preference in my experience.  Please do switch to the inline asm option.
I guess the distinction between these operations and others is that it isn't useful for the compiler to try to reason about these instructions, in the way that it's useful for it to reason about vector intrinsics. I'm happy with either LLVM intrinsics or inline asm.


http://reviews.llvm.org/D12278





More information about the cfe-commits mailing list