-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MLIR operation for unary operations
Signed-off-by: Anton Korobeynikov <[email protected]>
- Loading branch information
Showing
6 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef P4MLIR_DIALECT_P4HIR_P4HIR_OPSENUMS_H | ||
#define P4MLIR_DIALECT_P4HIR_P4HIR_OPSENUMS_H | ||
|
||
// We explicitly do not use push / pop for diagnostic in | ||
// order to propagate pragma further on | ||
#pragma GCC diagnostic ignored "-Wunused-parameter" | ||
|
||
#include "mlir/IR/BuiltinAttributes.h" | ||
#include "p4mlir/Dialect/P4HIR/P4HIR_OpsEnums.h.inc" | ||
|
||
#endif // P4MLIR_DIALECT_P4HIR_P4HIR_OPSENUMS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: p4mlir-opt %s | FileCheck %s | ||
|
||
// No need to check stuff. If it parses, it's fine. | ||
// CHECK: module | ||
module { | ||
%0 = p4hir.const #p4hir.int<-128> : !p4hir.int<8> | ||
%1 = p4hir.const #p4hir.bool<false> : !p4hir.bool | ||
|
||
%2 = p4hir.unary(minus, %0) : !p4hir.int<8> | ||
%3 = p4hir.unary(plus, %0) : !p4hir.int<8> | ||
%4 = p4hir.unary(cmpl, %0) : !p4hir.int<8> | ||
%5 = p4hir.unary(not, %1) : !p4hir.bool | ||
} |