Issue |
127271
|
Summary |
cpuid.h doesn't like -masm=intel
|
Labels |
new issue
|
Assignees |
|
Reporter |
Alcaro
|
```c
#include <cpuid.h>
unsigned get_cpuid_max(unsigned ext, unsigned* sig)
{
return __get_cpuid_max(ext, sig);
}
```
-masm=intel
Expected: Should work, like gcc; the relevant asm supports both at&t and intel syntax https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/cpuid.h#L280
Actual: The clang version of that header is at&t syntax only https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/cpuid.h#L271, and returns
```
In file included from <source>:1:
/opt/compiler-explorer/clang-19.1.0/lib/clang/19/include/cpuid.h:309:5: error: unknown token in _expression_
309 | __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
| ^
/opt/compiler-explorer/clang-19.1.0/lib/clang/19/include/cpuid.h:271:12: note: expanded from macro '__cpuid'
271 | " cpuid\n" \
| ^
<inline asm>:2:11: note: instantiated into assembly here
2 | xchgq %rbx,rdi
| ^
In file included from <source>:1:
/opt/compiler-explorer/clang-19.1.0/lib/clang/19/include/cpuid.h:309:5: error: unknown token in _expression_
309 | __cpuid(__leaf, __eax, __ebx, __ecx, __edx);
| ^
/opt/compiler-explorer/clang-19.1.0/lib/clang/19/include/cpuid.h:270:11: note: expanded from macro '__cpuid'
270 | __asm(" xchgq %%rbx,%q1\n" \
| ^
<inline asm>:4:10: note: instantiated into assembly here
4 | xchgq %rbx,rdi
| ^
```
https://godbolt.org/z/qMoPs5cPW
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs