// RUN: tblgen-to-irdl %s -I=%S/../../include --gen-dialect-irdl-defs --dialect=cmath | FileCheck %s include "mlir/IR/OpBase.td" include "mlir/IR/AttrTypeBase.td" // CHECK-LABEL: irdl.dialect @cmath { def CMath_Dialect : Dialect { let name = "cmath"; } class CMath_Type traits = []> : TypeDef { let mnemonic = typeMnemonic; } class CMath_Op traits = []> : Op; def f32Orf64Type : Or<[CPred<"::llvm::isa<::mlir::F32>">, CPred<"::llvm::isa<::mlir::F64>">]>; // CHECK: irdl.type @"!complex" def CMath_ComplexType : CMath_Type<"ComplexType", "complex"> { let parameters = (ins f32Orf64Type:$elementType); let assemblyFormat = "`<` $elementType `>`"; } // CHECK: irdl.operation @identity { // CHECK-NEXT: %0 = irdl.base @cmath::@"!complex" // CHECK-NEXT: irdl.results(out: %0) // CHECK-NEXT: } def CMath_IdentityOp : CMath_Op<"identity"> { let results = (outs CMath_ComplexType:$out); } // CHECK: irdl.operation @mul { // CHECK-NEXT: %0 = irdl.base @cmath::@"!complex" // CHECK-NEXT: %1 = irdl.base @cmath::@"!complex" // CHECK-NEXT: %2 = irdl.base @cmath::@"!complex" // CHECK-NEXT: irdl.operands(in1: %0, in2: %1) // CHECK-NEXT: irdl.results(out: %2) // CHECK-NEXT: } def CMath_MulOp : CMath_Op<"mul"> { let arguments = (ins CMath_ComplexType:$in1, CMath_ComplexType:$in2); let results = (outs CMath_ComplexType:$out); } // CHECK: irdl.operation @norm { // CHECK-NEXT: %0 = irdl.any // CHECK-NEXT: %1 = irdl.base @cmath::@"!complex" // CHECK-NEXT: irdl.operands(in: %0) // CHECK-NEXT: irdl.results(out: %1) // CHECK-NEXT: } def CMath_NormOp : CMath_Op<"norm"> { let arguments = (ins AnyType:$in); let results = (outs CMath_ComplexType:$out); }