]> Pileus Git - ~andy/linux/blobdiff - arch/mips/math-emu/cp1emu.c
Merge branch 'mips-next' of http://dev.phrozen.org/githttp/mips-next into mips-for...
[~andy/linux] / arch / mips / math-emu / cp1emu.c
index a03bf00a1a9cf096226b0ce09a590450018ba62f..47c77e7ffbf89102a07c19e900e29e4dd4cf510b 100644 (file)
@@ -171,16 +171,17 @@ static int isBranchInstr(mips_instruction * i)
  * In the Linux kernel, we support selection of FPR format on the
  * basis of the Status.FR bit.  If an FPU is not present, the FR bit
  * is hardwired to zero, which would imply a 32-bit FPU even for
- * 64-bit CPUs.  For 64-bit kernels with no FPU we use TIF_32BIT_REGS
- * as a proxy for the FR bit so that a 64-bit FPU is emulated.  In any
- * case, for a 32-bit kernel which uses the O32 MIPS ABI, only the
- * even FPRs are used (Status.FR = 0).
+ * 64-bit CPUs so we rather look at TIF_32BIT_REGS.
+ * FPU emu is slow and bulky and optimizing this function offers fairly
+ * sizeable benefits so we try to be clever and make this function return
+ * a constant whenever possible, that is on 64-bit kernels without O32
+ * compatibility enabled and on 32-bit kernels.
  */
 static inline int cop1_64bit(struct pt_regs *xcp)
 {
-       if (cpu_has_fpu)
-               return xcp->cp0_status & ST0_FR;
-#ifdef CONFIG_64BIT
+#if defined(CONFIG_64BIT) && !defined(CONFIG_MIPS32_O32)
+       return 1;
+#elif defined(CONFIG_64BIT) && defined(CONFIG_MIPS32_O32)
        return !test_thread_flag(TIF_32BIT_REGS);
 #else
        return 0;