forked from OSchip/llvm-project
[mlir] Add EqualOp and NotEqualOp to complex dialect.
This commit is contained in:
parent
62fca69a70
commit
a28fe17d73
|
@ -147,6 +147,29 @@ def ImOp : Complex_Op<"im",
|
|||
let hasFolder = 1;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// EqualOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def EqualOp : Complex_Op<"eq",
|
||||
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>]> {
|
||||
let summary = "computes whether two complex values are equal";
|
||||
let description = [{
|
||||
The `eq` op takes two complex numbers and returns whether they are equal.
|
||||
|
||||
Example:
|
||||
|
||||
```mlir
|
||||
%a = complex.eq %b, %c : complex<f32>
|
||||
```
|
||||
}];
|
||||
|
||||
let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
|
||||
let results = (outs I1:$result);
|
||||
|
||||
let assemblyFormat = "$lhs `,` $rhs attr-dict `:` type($lhs)";
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// MulOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -162,6 +185,30 @@ def MulOp : ComplexArithmeticOp<"mul"> {
|
|||
}];
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// NotEqualOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def NotEqualOp : Complex_Op<"neq",
|
||||
[NoSideEffect, AllTypesMatch<["lhs", "rhs"]>]> {
|
||||
let summary = "computes whether two complex values are not equal";
|
||||
let description = [{
|
||||
The `neq` op takes two complex numbers and returns whether they are not
|
||||
equal.
|
||||
|
||||
Example:
|
||||
|
||||
```mlir
|
||||
%a = complex.neq %b, %c : complex<f32>
|
||||
```
|
||||
}];
|
||||
|
||||
let arguments = (ins Complex<AnyFloat>:$lhs, Complex<AnyFloat>:$rhs);
|
||||
let results = (outs I1:$result);
|
||||
|
||||
let assemblyFormat = "$lhs `,` $rhs attr-dict `:` type($lhs)";
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ReOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/Complex/IR/Complex.h"
|
||||
#include "mlir/IR/Builders.h"
|
||||
|
||||
using namespace mlir;
|
||||
using namespace mlir::complex;
|
||||
|
|
|
@ -23,6 +23,12 @@ func @ops(%f: f32) {
|
|||
// CHECK: complex.div %[[C]], %[[C]] : complex<f32>
|
||||
%div = complex.div %complex, %complex : complex<f32>
|
||||
|
||||
// CHECK: complex.eq %[[C]], %[[C]] : complex<f32>
|
||||
%eq = complex.eq %complex, %complex : complex<f32>
|
||||
|
||||
// CHECK: complex.neq %[[C]], %[[C]] : complex<f32>
|
||||
%neq = complex.neq %complex, %complex : complex<f32>
|
||||
|
||||
// CHECK: complex.mul %[[C]], %[[C]] : complex<f32>
|
||||
%prod = complex.mul %complex, %complex : complex<f32>
|
||||
|
||||
|
|
Loading…
Reference in New Issue