Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the .td description for evalOp #1270

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/Dialect/Polynomial/IR/PolynomialOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,29 @@ def Polynomial_INTTOp : Polynomial_Op<"intt", [Pure]> {
let hasVerifier = 1;
}

def Polynomial_EvalOp : Polynomial_Op<"eval"> {
let summary = "Evaluate a static polynomial attribute at a given SSA value.";
let description = [{
Evaluates the result of a polynomial specified as a static attribute at a given SSA value.
The result represents the evaluation of the polynomial at the input value and produces
a corresponding constant value.

Example:

```mlir
#poly = #polynomial.int_polynomial<x**2 + 2*x + 1>
%x = arith.constant 5 : i32
%result = polynomial.eval #poly, %x : !arith.constant
```
}];

let arguments = (ins
Polynomial_AnyTypedPolynomialAttr:$polynomial, // Static polynomial attribute
AnyType:$value // SSA value
);

let results = (outs AnyType:$result);
let assemblyFormat = "$polynomial attr-dict `polynomial` $value type($value) `->` type($result)";
}

#endif // LIB_DIALECT_POLYNOMIAL_IR_POLYNOMIALOPS_TD_