xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVCombine.td (revision 700637cbb5e582861067a11aaca4d053546871d2)
1//=- SPIRVCombine.td - Define SPIRV Combine Rules -------------*-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
8include "llvm/Target/GlobalISel/Combine.td"
9
10
11def vector_length_sub_to_distance_lowering : GICombineRule <
12  (defs root:$root),
13  (match (wip_match_opcode G_INTRINSIC):$root,
14          [{ return matchLengthToDistance(*${root}, MRI); }]),
15  (apply [{ applySPIRVDistance(*${root}, MRI, B); }])
16>;
17
18def SPIRVPreLegalizerCombiner
19    : GICombiner<"SPIRVPreLegalizerCombinerImpl",
20                       [vector_length_sub_to_distance_lowering]> {
21    let CombineAllMethodName = "tryCombineAllImpl";
22}
23