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

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 12:45:29 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(
----------------
tschuett wrote:

>From scanning the legalizer I convinced myself that most opcodes that you build a legal. Now, that G_CONSTANT is custom, you can convince me that the constant is legal.

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


More information about the llvm-commits mailing list