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

Roberto Turrado Camblor via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 26 08:12:50 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.
----------------
rturrado wrote:

I have updated the `argument` variable to:
```
let arguments =
      (ins Arg<CIR_PtrToI32Array4, "array address", [MemWrite]>:$basePtr,
          CIR_SInt32:$funcId, CIR_SInt32:$subFuncId);
```

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


More information about the cfe-commits mailing list