1//==-- ShapeToStandard.td - Shape to Standard Patterns -------*- tablegen -*==//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// Defines Patterns to lower Shape ops to Std.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef MLIR_CONVERSION_SHAPETOSTANDARD_TD
14#define MLIR_CONVERSION_SHAPETOSTANDARD_TD
15
16include "mlir/Dialect/Shape/IR/ShapeOps.td"
17
18def BroadcastableStringAttr : NativeCodeCall<[{
19  $_builder.getStringAttr("required broadcastable shapes")
20}]>;
21
22def CstrBroadcastableToRequire : Pat<(Shape_CstrBroadcastableOp $shapes),
23            (Shape_CstrRequireOp
24              (Shape_IsBroadcastableOp $shapes),
25              (BroadcastableStringAttr))>;
26
27def EqStringAttr : NativeCodeCall<[{
28  $_builder.getStringAttr("required equal shapes")
29}]>;
30
31def CstrEqToRequire : Pat<(Shape_CstrEqOp $shapes),
32  (Shape_CstrRequireOp (Shape_ShapeEqOp $shapes), (EqStringAttr))>;
33
34#endif // MLIR_CONVERSION_SHAPETOSTANDARD_TD
35