1ad041a8cSMatt Arsenault //=== lib/CodeGen/GlobalISel/AMDGPUCombinerHelper.h -------------*- C++ -*-===// 2db6bc2abSMirko Brkusanin // 3db6bc2abSMirko Brkusanin // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4db6bc2abSMirko Brkusanin // See https://llvm.org/LICENSE.txt for license information. 5db6bc2abSMirko Brkusanin // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6db6bc2abSMirko Brkusanin // 7db6bc2abSMirko Brkusanin //===----------------------------------------------------------------------===// 8db6bc2abSMirko Brkusanin /// 9db6bc2abSMirko Brkusanin /// \file 10db6bc2abSMirko Brkusanin /// This contains common combine transformations that may be used in a combine 11db6bc2abSMirko Brkusanin /// pass. 12db6bc2abSMirko Brkusanin /// 13db6bc2abSMirko Brkusanin //===----------------------------------------------------------------------===// 14db6bc2abSMirko Brkusanin 15972a4e88SElliot Goodrich #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H 16972a4e88SElliot Goodrich #define LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H 17972a4e88SElliot Goodrich 18fd6f8b3cSVikash Gupta #include "GCNSubtarget.h" 19db6bc2abSMirko Brkusanin #include "llvm/CodeGen/GlobalISel/Combiner.h" 20db6bc2abSMirko Brkusanin #include "llvm/CodeGen/GlobalISel/CombinerHelper.h" 21db6bc2abSMirko Brkusanin 221753008bSRahul Joshi namespace llvm { 23db6bc2abSMirko Brkusanin class AMDGPUCombinerHelper : public CombinerHelper { 24fd6f8b3cSVikash Gupta protected: 25fd6f8b3cSVikash Gupta const GCNSubtarget &STI; 26fd6f8b3cSVikash Gupta const SIInstrInfo &TII; 27fd6f8b3cSVikash Gupta 28db6bc2abSMirko Brkusanin public: 29db6bc2abSMirko Brkusanin using CombinerHelper::CombinerHelper; 30fd6f8b3cSVikash Gupta AMDGPUCombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, 31fd6f8b3cSVikash Gupta bool IsPreLegalize, GISelKnownBits *KB, 32fd6f8b3cSVikash Gupta MachineDominatorTree *MDT, const LegalizerInfo *LI, 33fd6f8b3cSVikash Gupta const GCNSubtarget &STI); 34db6bc2abSMirko Brkusanin 35*bbb53d1aSPaul Bowen-Huggett bool matchFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const; 36*bbb53d1aSPaul Bowen-Huggett void applyFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const; 372f5a116cSMatt Arsenault 382f5a116cSMatt Arsenault bool matchExpandPromotedF16FMed3(MachineInstr &MI, Register Src0, 39*bbb53d1aSPaul Bowen-Huggett Register Src1, Register Src2) const; 402f5a116cSMatt Arsenault void applyExpandPromotedF16FMed3(MachineInstr &MI, Register Src0, 41*bbb53d1aSPaul Bowen-Huggett Register Src1, Register Src2) const; 42fd6f8b3cSVikash Gupta 43fd6f8b3cSVikash Gupta bool matchCombineFmulWithSelectToFldexp( 44fd6f8b3cSVikash Gupta MachineInstr &MI, MachineInstr &Sel, 45*bbb53d1aSPaul Bowen-Huggett std::function<void(MachineIRBuilder &)> &MatchInfo) const; 46db6bc2abSMirko Brkusanin }; 47972a4e88SElliot Goodrich 481753008bSRahul Joshi } // namespace llvm 491753008bSRahul Joshi 50972a4e88SElliot Goodrich #endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H 51