[clang] [clang][Mips] Set _MIPS_SPFPSET to 16 before MIPS32 with 32-bit FPRs (PR #246579)

Alex Rønne Petersen via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 27 01:32:48 PST 2026


================
@@ -381,6 +384,13 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
       Features.push_back("+fp64");
     }
 
+    // Before MIPS32, single-precision arithmetic can't use the odd FPRs when
+    // the FPRs are 32 bits wide, so the backend doesn't use them. A
+    // single-float FPU has 32 single-precision FPRs. The R5900 is single-float,
+    // but that is implied by the CPU and not passed as a feature here.
+    if (ISALevel < 32 && FPMode != FP64 && !IsSingleFloat && !IsR5900)
+      NoOddSpreg = true;
----------------
alexrp wrote:

The check should be `ISALevel < 32 && FPMode != FP64 && !IsR5900 && !OddSpregGiven` to match GCC, and to respect an explicit `-modd-spreg`.

But more problematically, it looks like this would go out of sync with the backend's notion of it.

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


More information about the cfe-commits mailing list