<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127271>127271</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
cpuid.h doesn't like -masm=intel
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alcaro
</td>
</tr>
</table>
<pre>
```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
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVk2P4jgQ_TXmUmrklAkhhxwyzKBdaVcaaVfaIzJOQbzt2Gnb6ab316_sANPN7Ncc5rY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