SPIRVCanonicalization.td
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//==- SPIRVCanonicalization.td - Canonicalization Patterns ---*- tablegen -*==//
// Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines SPIR-V canonicalization patterns.
//
//===----------------------------------------------------------------------===//
include "mlir/Dialect/SPIRV/SPIRVOps.td"
//===----------------------------------------------------------------------===//
// spv.Bitcast
//===----------------------------------------------------------------------===//
def ConvertChainedBitcast : Pat<(SPV_BitcastOp (SPV_BitcastOp $operand)),
(SPV_BitcastOp $operand)>;
//===----------------------------------------------------------------------===//
// spv.LogicalNot
//===----------------------------------------------------------------------===//
def ConvertLogicalNotOfIEqual : Pat<
(SPV_LogicalNotOp (SPV_IEqualOp $lhs, $rhs)),
(SPV_INotEqualOp $lhs, $rhs)>;
def ConvertLogicalNotOfINotEqual : Pat<
(SPV_LogicalNotOp (SPV_INotEqualOp $lhs, $rhs)),
(SPV_IEqualOp $lhs, $rhs)>;
def ConvertLogicalNotOfLogicalEqual : Pat<
(SPV_LogicalNotOp (SPV_LogicalEqualOp $lhs, $rhs)),
(SPV_LogicalNotEqualOp $lhs, $rhs)>;
def ConvertLogicalNotOfLogicalNotEqual : Pat<
(SPV_LogicalNotOp (SPV_LogicalNotEqualOp $lhs, $rhs)),
(SPV_LogicalEqualOp $lhs, $rhs)>;