[Mlir-commits] [mlir] [mlir][arith] Add support for `extf`, `truncf` to `ArithToAPFloat` (PR #169275)
Jakub Kuderski
llvmlistbot at llvm.org
Mon Nov 24 06:53:32 PST 2025
================
@@ -41,24 +41,15 @@ static FuncOp createFnDecl(OpBuilder &b, SymbolOpInterface symTable,
}
/// Helper function to look up or create the symbol for a runtime library
-/// function for a binary arithmetic operation.
-///
-/// Parameter 1: APFloat semantics
-/// Parameter 2: Left-hand side operand
-/// Parameter 3: Right-hand side operand
-///
-/// This function will return a failure if the function is found but has an
-/// unexpected signature.
-///
+/// function with the given parameter types. Always returns an int64_t.
static FailureOr<FuncOp>
-lookupOrCreateBinaryFn(OpBuilder &b, SymbolOpInterface symTable, StringRef name,
- SymbolTableCollection *symbolTables = nullptr) {
- auto i32Type = IntegerType::get(symTable->getContext(), 32);
+lookupOrCreateApFloatFn(OpBuilder &b, SymbolOpInterface symTable,
+ StringRef name, TypeRange paramTypes,
+ SymbolTableCollection *symbolTables = nullptr) {
auto i64Type = IntegerType::get(symTable->getContext(), 64);
std::string funcName = (llvm::Twine("_mlir_apfloat_") + name).str();
- FunctionType funcT =
- FunctionType::get(b.getContext(), {i32Type, i64Type, i64Type}, {i64Type});
+ FunctionType funcT = FunctionType::get(b.getContext(), paramTypes, {i64Type});
----------------
kuhar wrote:
nit
```suggestion
auto funcT = FunctionType::get(b.getContext(), paramTypes, {i64Type});
```
https://github.com/llvm/llvm-project/pull/169275
More information about the Mlir-commits
mailing list