[llvm] [AArch64][GlobalISel] Use GPR for illegal fconstants and extend < 32 bit GPR constants to 32 bits (PR #178692)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 30 06:26:26 PST 2026
================
@@ -2121,6 +2123,18 @@ bool AArch64InstructionSelector::preISelLower(MachineInstr &I) {
MachineRegisterInfo &MRI = MF.getRegInfo();
switch (I.getOpcode()) {
+ case TargetOpcode::G_CONSTANT: {
+ Register DefReg = I.getOperand(0).getReg();
+ const LLT DefTy = MRI.getType(DefReg);
+ if (!DefTy.isPointer())
+ return false;
+ const unsigned PtrSize = DefTy.getSizeInBits();
+ if (PtrSize != 32 && PtrSize != 64)
+ return false;
+ // Convert pointer typed constants to integers so TableGen can select.
+ MRI.setType(DefReg, LLT::scalar(PtrSize));
----------------
arsenm wrote:
Do you really still need this type hacking? I swear I remember a tablegen patch to fix pointer typed patterns
https://github.com/llvm/llvm-project/pull/178692
More information about the llvm-commits
mailing list