1 //==-- ShapeToStandard.td - Shape to Standard Patterns -------*- tablegen -*==//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Defines Patterns to lower Shape ops to Std.
11 //===----------------------------------------------------------------------===//
13 #ifndef MLIR_CONVERSION_SHAPETOSTANDARD_TD
14 #define MLIR_CONVERSION_SHAPETOSTANDARD_TD
16 include "mlir/IR/PatternBase.td"
17 include "mlir/Dialect/Shape/IR/ShapeOps.td"
19 def BroadcastableStringAttr : NativeCodeCall<[{
20 $_builder.getStringAttr("required broadcastable shapes")
23 def CstrBroadcastableToRequire : Pat<(Shape_CstrBroadcastableOp $shapes),
25 (Shape_IsBroadcastableOp $shapes),
26 (BroadcastableStringAttr))>;
28 def EqStringAttr : NativeCodeCall<[{
29 $_builder.getStringAttr("required equal shapes")
32 def CstrEqToRequire : Pat<(Shape_CstrEqOp $shapes),
33 (Shape_CstrRequireOp (Shape_ShapeEqOp $shapes), (EqStringAttr))>;
35 #endif // MLIR_CONVERSION_SHAPETOSTANDARD_TD