[llvm] [AArch64][GlobalISel] Remove fconstant_to_constant, moving it to reg-bank-select. (PR #194778)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Sun May 3 20:35:04 PDT 2026


================
@@ -379,6 +380,13 @@ static bool preferGPRForFPImm(const MachineInstr &MI,
   const APFloat Imm = MI.getOperand(1).getFPImm()->getValueAPF();
   const APInt ImmBits = Imm.bitcastToAPInt();
 
+  // If all the uses are stores use a gpr constant
+  if (all_of(MRI.use_nodbg_instructions(Dst), [&](const MachineInstr &UseMI) {
+        return UseMI.getOpcode() == TargetOpcode::G_STORE &&
+               UseMI.getOperand(0).getReg() == Dst;
+      }))
+    return true;
+
----------------
aemerson wrote:

No real codegen tests changed here so maybe I'm wrong: but are we sure that this heuristic should take precedence over the movi/fmov encodable constant code below? Are there cases that can trigger where we it costs us multiple movz/movk to materialize what would have been a single FP imm move?

https://github.com/llvm/llvm-project/pull/194778


More information about the llvm-commits mailing list