30 lines · plain
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-exception6//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 Helper.matchLengthToDistance(*${root}); }]),15 (apply [{ Helper.applySPIRVDistance(*${root}); }])16>;17 18def vector_select_to_faceforward_lowering : GICombineRule <19 (defs root:$root),20 (match (wip_match_opcode G_SELECT):$root,21 [{ return Helper.matchSelectToFaceForward(*${root}); }]),22 (apply [{ Helper.applySPIRVFaceForward(*${root}); }])23>;24 25def SPIRVPreLegalizerCombiner26 : GICombiner<"SPIRVPreLegalizerCombinerImpl",27 [vector_length_sub_to_distance_lowering, vector_select_to_faceforward_lowering]> {28 let CombineAllMethodName = "tryCombineAllImpl";29}30