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/IR/PatternBase.td" 17include "mlir/Dialect/Shape/IR/ShapeOps.td" 18 19def BroadcastableStringAttr : NativeCodeCall<[{ 20 $_builder.getStringAttr("required broadcastable shapes") 21}]>; 22 23def CstrBroadcastableToRequire : Pat<(Shape_CstrBroadcastableOp $shapes), 24 (Shape_CstrRequireOp 25 (Shape_IsBroadcastableOp $shapes), 26 (BroadcastableStringAttr))>; 27 28def EqStringAttr : NativeCodeCall<[{ 29 $_builder.getStringAttr("required equal shapes") 30}]>; 31 32def CstrEqToRequire : Pat<(Shape_CstrEqOp $shapes), 33 (Shape_CstrRequireOp (Shape_ShapeEqOp $shapes), (EqStringAttr))>; 34 35#endif // MLIR_CONVERSION_SHAPETOSTANDARD_TD 36