[clang] [clang][x86] Support -masm=intel in cpuid.h (PR #127331)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 15 07:32:16 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 21e956df9b2b283c2f2ed710c542ebeebf8473ff 90e3f502e582f44cd19e1b8b71d218330b13c9e4 --extensions h -- clang/lib/Headers/cpuid.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Headers/cpuid.h b/clang/lib/Headers/cpuid.h
index d8ace39d4e..52addb7bfa 100644
--- a/clang/lib/Headers/cpuid.h
+++ b/clang/lib/Headers/cpuid.h
@@ -267,18 +267,18 @@
: "0"(__leaf), "2"(__count))
#else
/* x86-64 uses %rbx as the base register, so preserve it. */
-#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
- __asm(" xchg{q|} {%%|}rbx,%q1\n" \
- " cpuid\n" \
- " xchg{q|} {%%|}rbx,%q1" \
- : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
+#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
+ __asm(" xchg{q|} {%%|}rbx,%q1\n" \
+ " cpuid\n" \
+ " xchg{q|} {%%|}rbx,%q1" \
+ : "=a"(__eax), "=r"(__ebx), "=c"(__ecx), "=d"(__edx) \
: "0"(__leaf))
-#define __cpuid_count(__leaf, __count, __eax, __ebx, __ecx, __edx) \
- __asm(" xchg{q|} {%%|}rbx,%q1\n" \
- " cpuid\n" \
- " xchg{q|} {%%|}rbx,%q1" \
- : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
+#define __cpuid_count(__leaf, __count, __eax, __ebx, __ecx, __edx) \
+ __asm(" xchg{q|} {%%|}rbx,%q1\n" \
+ " cpuid\n" \
+ " xchg{q|} {%%|}rbx,%q1" \
+ : "=a"(__eax), "=r"(__ebx), "=c"(__ecx), "=d"(__edx) \
: "0"(__leaf), "2"(__count))
#endif
@@ -302,7 +302,9 @@ static __inline unsigned int __get_cpuid_max (unsigned int __leaf,
" je 1f\n"
" mov{l|} {$1,%0|%0,1}\n"
"1:"
- : "=r" (__cpuid_supported) : : "eax", "ecx");
+ : "=r"(__cpuid_supported)
+ :
+ : "eax", "ecx");
if (!__cpuid_supported)
return 0;
#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/127331
More information about the cfe-commits
mailing list