[PATCH] D22181: Add runtime support for __cpu_model (__builtin_cpu_supports)

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 12:45:59 PDT 2016


echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

I'm not sure the asserts are necessary, but I know you like them. That said, couple of inline comments then OK.

Thanks!

-eric


================
Comment at: lib/builtins/cpu_model.c:193
@@ +192,3 @@
+#else
+  assert(0 && "This method is defined only for GNUC, Clang or Win.");
+#endif
----------------
or MSVC.

================
Comment at: lib/builtins/cpu_model.c:205
@@ +204,3 @@
+#if defined(__GNUC__) || defined(__clang__)
+  // gcc doesn't know cpuid would clobber ebx/rbx. Preseve it manually.
+  asm("movq\t%%rbx, %%rsi\n\t"
----------------
Add a FIXME to find out if we should save this for clang as well please?

================
Comment at: lib/builtins/cpu_model.c:243
@@ +242,3 @@
+#else
+  assert(0 && "This method is defined only for GNUC, Clang or Win.");
+#endif
----------------
or MSVC


https://reviews.llvm.org/D22181





More information about the llvm-commits mailing list