[llvm] [AArch64][GlobalISel] Use GPR for illegal fconstants and extend < 32 bit GPR constants to 32 bits (PR #178692)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 16 15:02:48 PST 2026
================
@@ -358,12 +359,77 @@ AArch64RegisterBankInfo::getInstrAlternativeMappings(
return RegisterBankInfo::getInstrAlternativeMappings(MI);
}
+static bool isLegalFPImm(const MachineInstr &MI, const MachineRegisterInfo &MRI,
+ const AArch64Subtarget &STI) {
+ assert(MI.getOpcode() == TargetOpcode::G_FCONSTANT);
+ Register Dst = MI.getOperand(0).getReg();
+ LLT Ty = MRI.getType(Dst);
+ if (!Ty.isScalar())
+ return false;
+
+ unsigned Bits = Ty.getSizeInBits();
+ if (Bits != 16 && Bits != 32 && Bits != 64)
+ return false;
+
+ EVT VT = EVT::getFloatingPointVT(Bits);
+ bool OptForSize = MI.getMF()->getFunction().hasOptSize() ||
+ MI.getMF()->getFunction().hasMinSize();
----------------
davemgreen wrote:
Can we use shouldOptimizeForSize.
https://github.com/llvm/llvm-project/pull/178692
More information about the llvm-commits
mailing list