diff options
author | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-09-16 15:12:40 +0000 |
---|---|---|
committer | Ahmed Bougacha <ahmed.bougacha@gmail.com> | 2016-09-16 15:12:40 +0000 |
commit | 90637f61961bd7a3d2c56b15ced60b36ca6ca940 (patch) | |
tree | e86f232706e62877d51bbb051426131796c617c0 /llvm/lib | |
parent | d31907957a6cfcd500a620a241ffecc1b98eec5a (diff) | |
download | bcm5719-llvm-90637f61961bd7a3d2c56b15ced60b36ca6ca940.tar.gz bcm5719-llvm-90637f61961bd7a3d2c56b15ced60b36ca6ca940.zip |
[AArch64][GlobalISel] Add default regbank mapping for FP ops.
These should have all their operands - even scalars - go on FPR.
llvm-svn: 281737
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index 15aef07a031..ab70820e086 100644 --- a/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -169,6 +169,22 @@ void AArch64RegisterBankInfo::applyMappingImpl( } } +/// Returns whether opcode \p Opc is a pre-isel generic floating-point opcode, +/// having only floating-point operands. +static bool isPreISelGenericFloatingPointOpcode(unsigned Opc) { + switch (Opc) { + case TargetOpcode::G_FADD: + case TargetOpcode::G_FSUB: + case TargetOpcode::G_FMUL: + case TargetOpcode::G_FDIV: + case TargetOpcode::G_FCONSTANT: + case TargetOpcode::G_FPEXT: + case TargetOpcode::G_FPTRUNC: + return true; + } + return false; +} + RegisterBankInfo::InstructionMapping AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { const unsigned Opc = MI.getOpcode(); @@ -198,7 +214,8 @@ AArch64RegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { OpSizes[Idx] = Ty.getSizeInBits(); // As a top-level guess, vectors go in FPRs, scalars and pointers in GPRs. - if (Ty.isVector()) + // For floating-point instructions, scalars go in FPRs. + if (Ty.isVector() || isPreISelGenericFloatingPointOpcode(Opc)) OpBanks[Idx] = AArch64::FPRRegBankID; else OpBanks[Idx] = AArch64::GPRRegBankID; |