1*700637cbSDimitry Andric//=- SPIRVCombine.td - Define SPIRV Combine Rules -------------*-tablegen -*-=// 2*700637cbSDimitry Andric// 3*700637cbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*700637cbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*700637cbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*700637cbSDimitry Andric// 7*700637cbSDimitry Andric 8*700637cbSDimitry Andricinclude "llvm/Target/GlobalISel/Combine.td" 9*700637cbSDimitry Andric 10*700637cbSDimitry Andric 11*700637cbSDimitry Andricdef vector_length_sub_to_distance_lowering : GICombineRule < 12*700637cbSDimitry Andric (defs root:$root), 13*700637cbSDimitry Andric (match (wip_match_opcode G_INTRINSIC):$root, 14*700637cbSDimitry Andric [{ return matchLengthToDistance(*${root}, MRI); }]), 15*700637cbSDimitry Andric (apply [{ applySPIRVDistance(*${root}, MRI, B); }]) 16*700637cbSDimitry Andric>; 17*700637cbSDimitry Andric 18*700637cbSDimitry Andricdef SPIRVPreLegalizerCombiner 19*700637cbSDimitry Andric : GICombiner<"SPIRVPreLegalizerCombinerImpl", 20*700637cbSDimitry Andric [vector_length_sub_to_distance_lowering]> { 21*700637cbSDimitry Andric let CombineAllMethodName = "tryCombineAllImpl"; 22*700637cbSDimitry Andric} 23