[PATCH] D43394: [X86] Add 'sahf' CPU feature, and emit __LAHFSAHF__ for it

Dimitry Andric via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 16 14:57:45 PST 2018


dim added inline comments.


================
Comment at: lib/Basic/Targets/X86.cpp:1049
 
+  if (HasLAHFSAHF)
+    Builder.defineMacro("__LAHFSAHF__");
----------------
craig.topper wrote:
> Does gcc define this? It's such a low level instruction I have a hard time believing this define would be useful.
I tried gcc 6, 7 and 8, and while they do expose stuff like `__POPCNT__`, I see no `__LAHFSAHF__`.  I am supposing Jonathan's original intent with this was to make it easily testable in source, so you can insert the right assembly for the target CPU.  The same could really be said for things like `__RDSEED__`, and some other defines...


Repository:
  rC Clang

https://reviews.llvm.org/D43394





More information about the cfe-commits mailing list