[llvm] [mlir] [mlir][EmitC] Add MathToEmitC pass for math function lowering to EmitC (PR #113799)

Marius Brehler via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 12:35:07 PDT 2024


================
@@ -780,6 +780,22 @@ def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> {
   let dependentDialects = ["spirv::SPIRVDialect"];
 }
 
+//===----------------------------------------------------------------------===//
+// MathToEmitC
+//===----------------------------------------------------------------------===//
+
+def ConvertMathToEmitC  : Pass<"convert-math-to-emitc", "ModuleOp"> {
+  let summary = "Convert some Math operations to EmitC Call_opaque";
+  let description = [{
+    This pass converts supported Math ops to opaque_call ops targeting libc/libm functions.
+    Unlike convert-math-to-funcs pass, this pass uses call_opaque,
+    therefore enables us to overload the same funtion with different argument types
----------------
marbre wrote:

Idk the exact line length limit but I think lines should be broken after fewer character. Beside that a suggestion how one could rephrase a little:
```suggestion
    This pass converts supported Math ops to `opaque_call` ops targeting libc/libm
    functions. Unlike convert-math-to-funcs pass, converting to `call_opaque` ops
    allows to overload the same function with different argument types.
```

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


More information about the llvm-commits mailing list