================
@@ -4282,6 +4283,68 @@ mlir::LogicalResult 
CIRToLLVMAwaitOpLowering::matchAndRewrite(
   return mlir::failure();
 }
 
+mlir::LogicalResult CIRToLLVMCpuIdOpLowering::matchAndRewrite(
+    cir::CpuIdOp op, OpAdaptor adaptor,
+    mlir::ConversionPatternRewriter &rewriter) const {
+  mlir::Type i32Ty = rewriter.getI32Type();
+  mlir::Type i64Ty = rewriter.getI64Type();
+  mlir::Type i32PtrTy = mlir::LLVM::LLVMPointerType::get(i32Ty.getContext(), 
0);
+
+  mlir::Type cpuidRetTy = mlir::LLVM::LLVMStructType::getLiteral(
+      rewriter.getContext(), {i32Ty, i32Ty, i32Ty, i32Ty});
+
+  mlir::Value funcId = adaptor.getFuncId();
+  mlir::Value subFuncId = adaptor.getSubFuncId();
+  std::array<mlir::Value, 2> operands{funcId, subFuncId};
+
+  StringRef asmString, constraints;
+  if (const llvm::Triple &triple = lowerMod->getTarget().getTriple();
----------------
andykaylor wrote:

I'm trying to remove `lowerMod` from this pass. `createLowerModule` gets the 
triple exactly the way you did it before. The fact that this even needs to know 
the triple kind of implies that this lowering should be happening in an earlier 
pass but let's leave it here for now and move it when we have more target 
lowering implemented.

https://github.com/llvm/llvm-project/pull/173197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to