[clang] [CIR][X86] Add support for `cpuid`/`cpuidex` (PR #173197)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 28 06:14:17 PST 2025


================
@@ -5819,4 +5762,31 @@ def CIR_BlockAddressOp : CIR_Op<"block_address", [Pure]> {
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// CpuIdOp
+//===----------------------------------------------------------------------===//
+
+def CIR_CpuIdOp : CIR_Op<"cpuid"> {
+  let summary = "Get information about the CPU";
+  let description = [{
+    The `cir.cpuid` operation takes a base pointer to an array of 4 integers, a
+    function ID and a sub-function ID. The array of 4 integers is filled with
+    different information about the processor.
----------------
Lancern wrote:

> Do you think we have to set let hasVerifier = 1 and implement verify() to add extra checks on basePtr?

The principle is as long as you could specify the constraint in TableGen you should avoid `hasVerifier`. Since you have already updated the constraints of `$basePtr`, it should be just fine now.

https://github.com/llvm/llvm-project/pull/173197


More information about the cfe-commits mailing list