[PATCH] D150646: [clang][X86] Add __cpuidex function to cpuid.h

Aiden Grossman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 17:39:23 PDT 2023


aidengrossman added a comment.

In D150646#4379543 <https://reviews.llvm.org/D150646#4379543>, @glandium wrote:

> There seem to still be two problems with this change, with mingw:
>
> - with `-fms-extensions`:
>
>   echo '#include "cpuid.h"' | ./clang/bin/clang++ --target=x86_64-w64-windows-gnu -xc++ - -fms-extensions
>   In file included from <stdin>:1:
>   /tmp/clang/lib/clang/17/include/cpuid.h:334:22: error: definition of builtin function '__cpuidex'
>   static __inline void __cpuidex (int __cpu_info[4], int __leaf, int __subleaf)
>                        ^
>   1 error generated.

Interesting. I would've thought `-fms-extensions` by itself would've declared that macro (which is what I gathered reading what caused the MSVC compatible builtins to get included in clang), but apparently not. For whatever reason, `LangOpts.MicrosoftExt` only seems to be set to true if `-fms-compaitilibty-version` (maybe on top of `-fms-compatibility`) are also passed (not 100% on this though). I'll have to do some more digging soon.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150646/new/

https://reviews.llvm.org/D150646



More information about the cfe-commits mailing list