1//==- SPIRVCanonicalization.td - Canonicalization 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// This file defines SPIR-V canonicalization patterns. 10// 11//===----------------------------------------------------------------------===// 12 13include "mlir/Dialect/SPIRV/SPIRVOps.td" 14 15//===----------------------------------------------------------------------===// 16// spv.Bitcast 17//===----------------------------------------------------------------------===// 18 19def ConvertChainedBitcast : Pat<(SPV_BitcastOp (SPV_BitcastOp $operand)), 20 (SPV_BitcastOp $operand)>; 21 22//===----------------------------------------------------------------------===// 23// spv.LogicalNot 24//===----------------------------------------------------------------------===// 25 26def ConvertLogicalNotOfIEqual : Pat< 27 (SPV_LogicalNotOp (SPV_IEqualOp $lhs, $rhs)), 28 (SPV_INotEqualOp $lhs, $rhs)>; 29 30def ConvertLogicalNotOfINotEqual : Pat< 31 (SPV_LogicalNotOp (SPV_INotEqualOp $lhs, $rhs)), 32 (SPV_IEqualOp $lhs, $rhs)>; 33 34def ConvertLogicalNotOfLogicalEqual : Pat< 35 (SPV_LogicalNotOp (SPV_LogicalEqualOp $lhs, $rhs)), 36 (SPV_LogicalNotEqualOp $lhs, $rhs)>; 37 38def ConvertLogicalNotOfLogicalNotEqual : Pat< 39 (SPV_LogicalNotOp (SPV_LogicalNotEqualOp $lhs, $rhs)), 40 (SPV_LogicalEqualOp $lhs, $rhs)>; 41