[llvm] [GlobalISel][ARM] Legalize reset_fpmode (PR #115859)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 09:23:58 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(
----------------
arsenm wrote:

Yes, incremental legalization should be relied on. Legalize actions are not responsible for ensuring every output is legal 

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


More information about the llvm-commits mailing list