diff options
Diffstat (limited to 'llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h')
-rw-r--r-- | llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h b/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h index bed1136c7a67..f9a1ee11140a 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h +++ b/llvm/lib/Target/AArch64/GISel/AArch64GlobalISelUtils.h @@ -11,10 +11,17 @@ #ifndef LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H #define LLVM_LIB_TARGET_AARCH64_GISEL_AARCH64GLOBALISELUTILS_H - +#include "MCTargetDesc/AArch64AddressingModes.h" +#include "Utils/AArch64BaseInfo.h" +#include "llvm/ADT/Optional.h" +#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" +#include "llvm/CodeGen/GlobalISel/Utils.h" +#include "llvm/CodeGen/Register.h" +#include "llvm/IR/InstrTypes.h" #include <cstdint> namespace llvm { + namespace AArch64GISelUtils { /// \returns true if \p C is a legal immediate operand for an arithmetic @@ -23,6 +30,51 @@ constexpr bool isLegalArithImmed(const uint64_t C) { return (C >> 12 == 0) || ((C & 0xFFFULL) == 0 && C >> 24 == 0); } +/// \returns A value when \p MI is a vector splat of a Register or constant. +/// Checks for generic opcodes and AArch64-specific generic opcodes. +Optional<RegOrConstant> getAArch64VectorSplat(const MachineInstr &MI, + const MachineRegisterInfo &MRI); + +/// \returns A value when \p MI is a constant vector splat. +/// Checks for generic opcodes and AArch64-specific generic opcodes. +Optional<int64_t> getAArch64VectorSplatScalar(const MachineInstr &MI, + const MachineRegisterInfo &MRI); + +/// \returns true if \p MaybeSub and \p Pred are part of a CMN tree for an +/// integer compare. +bool isCMN(const MachineInstr *MaybeSub, const CmpInst::Predicate &Pred, + const MachineRegisterInfo &MRI); + +/// Replace a G_MEMSET with a value of 0 with a G_BZERO instruction if it is +/// supported and beneficial to do so. +/// +/// \note This only applies on Darwin. +/// +/// \returns true if \p MI was replaced with a G_BZERO. +bool tryEmitBZero(MachineInstr &MI, MachineIRBuilder &MIRBuilder, bool MinSize); + +/// Find the AArch64 condition codes necessary to represent \p P for a scalar +/// floating point comparison. +/// +/// \param [out] CondCode is the first condition code. +/// \param [out] CondCode2 is the second condition code if necessary. +/// AArch64CC::AL otherwise. +void changeFCMPPredToAArch64CC(const CmpInst::Predicate P, + AArch64CC::CondCode &CondCode, + AArch64CC::CondCode &CondCode2); + +/// Find the AArch64 condition codes necessary to represent \p P for a vector +/// floating point comparison. +/// +/// \param [out] CondCode - The first condition code. +/// \param [out] CondCode2 - The second condition code if necessary. +/// AArch64CC::AL otherwise. +/// \param [out] Invert - True if the comparison must be inverted with a NOT. +void changeVectorFCMPPredToAArch64CC(const CmpInst::Predicate P, + AArch64CC::CondCode &CondCode, + AArch64CC::CondCode &CondCode2, + bool &Invert); + } // namespace AArch64GISelUtils } // namespace llvm |