+/* Fast FPU mode is a bit inaccurate (non IEEE), but definitely faster */
+static void fpu_set_fast_mode(int fast_mode)
+{
+#ifdef __arm__
+ if (fast_mode)
+ {
+ int tmp;
+ __asm__ volatile(
+ "fmrx %[tmp], fpscr\n"
+ "orr %[tmp], %[tmp], #(1 << 24)\n" /* flush-to-zero */
+ "orr %[tmp], %[tmp], #(1 << 25)\n" /* default NaN */
+ "bic %[tmp], %[tmp], #((1 << 15) | (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8))\n" /* clear exception bits */
+ "fmxr fpscr, %[tmp]\n"
+ : [tmp] "=r" (tmp)
+ );
+ }
+ else
+ {
+ int tmp;
+ __asm__ volatile(
+ "fmrx %[tmp], fpscr\n"
+ "bic %[tmp], %[tmp], #(1 << 24)\n" /* flush-to-zero */
+ "bic %[tmp], %[tmp], #(1 << 25)\n" /* default NaN */
+ "fmxr fpscr, %[tmp]\n"
+ : [tmp] "=r" (tmp)
+ );
+ }
+#endif /* if __arm__ */
+}
+