[llvm] [GlobalISel][ARM] Legalize reset_fpmode (PR #115859)
Serge Pavlov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 12 23:50:44 PST 2024
================
@@ -467,6 +468,18 @@ bool ARMLegalizerInfo::legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI,
MIRBuilder.buildSetFPEnv(NewFPSCR);
break;
}
+ case G_RESET_FPMODE: {
+ // To get the default FP mode all control bits are cleared:
+ // FPSCR = FPSCR & (FPStatusBits | FPReservedBits)
+ LLT FPEnvTy = LLT::scalar(32);
+ auto FPEnv = MRI.createGenericVirtualRegister(FPEnvTy);
+ MIRBuilder.buildInstr(G_GET_FPENV).addDef({FPEnv});
+ auto NotModeBitMask = MIRBuilder.buildConstant(
----------------
spavloff wrote:
The G_CONSTANT is illegal. When legalizer creates it in `legalizeInstrStep`, the object of type `LegalizerWorkListManager` adds this instruction to its worklist, and it will be subjected to legalization in next iterations of the legalization in `legalizeMachineFunction`.
https://github.com/llvm/llvm-project/pull/115859
More information about the llvm-commits
mailing list