From: Alberto Mardegan Date: Thu, 7 Jul 2011 05:54:42 +0000 (+0300) Subject: Use fast FPU mode X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=5ab6c930dc5db1adb24813b2d7d4c5ec82107c67;p=neverball Use fast FPU mode --- diff --git a/share/maemo.c b/share/maemo.c index fa67e8a..7a16ff8 100644 --- a/share/maemo.c +++ b/share/maemo.c @@ -31,6 +31,36 @@ static Uint32 disable_display_blank(Uint32 interval, void *param) return interval; } +/* 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__ */ +} + int maemo_init(const char *program) { osso_context = osso_initialize(program, "1.0", 0, NULL); @@ -41,6 +71,8 @@ int maemo_init(const char *program) osso_display_blanking_pause(osso_context); screen_timer_id = SDL_AddTimer(30000, disable_display_blank, NULL); + + fpu_set_fast_mode(1); return 1; }