Skip to content

Commit 11fdead

Browse files
EtoAndruwamarbre
andauthored
[mlir][emitc][NFC] Add an example to the description of the emitc.literal operation (#128005)
Co-authored-by: Marius Brehler <[email protected]>
1 parent 850b492 commit 11fdead

File tree

1 file changed

+11
-0
lines changed
  • mlir/include/mlir/Dialect/EmitC/IR

1 file changed

+11
-0
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,17 @@ def EmitC_LiteralOp : EmitC_Op<"literal", [Pure]> {
844844
let description = [{
845845
The `emitc.literal` operation produces an SSA value equal to some constant
846846
specified by an attribute.
847+
848+
Example:
849+
850+
```mlir
851+
%p0 = emitc.literal "M_PI" : f32
852+
%1 = "emitc.add" (%arg0, %p0) : (f32, f32) -> f32
853+
```
854+
```c++
855+
// Code emitted for the operation above.
856+
float v2 = v1 + M_PI;
857+
```
847858
}];
848859

849860
let arguments = (ins StrAttr:$value);

0 commit comments

Comments
 (0)