#include "Common/Math/math_util.h"1#include <stdlib.h>23// QNX can only use RunFast mode and it is already the default.4#if defined(__ARM_ARCH_7A__)5// Enables 'RunFast' VFP mode.6void EnableFZ() {7int x;8asm(9"fmrx %[result],FPSCR \r\n"10"orr %[result],%[result],#16777216 \r\n"11"fmxr FPSCR,%[result]"12:[result] "=r" (x) : :13);14//printf("ARM FPSCR: %08x\n",x);15}1617// New fastmode code from: http://pandorawiki.org/Floating_Point_Optimization18// These settings turbocharge the slow VFP unit on Cortex-A8 based chips by setting19// restrictions that permit running VFP instructions on the NEON unit.20// Denormal flush-to-zero, for example.21void FPU_SetFastMode() {22static const unsigned int x = 0x04086060;23static const unsigned int y = 0x03000000;24int r;25asm volatile (26"fmrx %0, fpscr \n\t" //r0 = FPSCR27"and %0, %0, %1 \n\t" //r0 = r0 & 0x0408606028"orr %0, %0, %2 \n\t" //r0 = r0 | 0x0300000029"fmxr fpscr, %0 \n\t" //FPSCR = r030: "=r"(r)31: "r"(x), "r"(y)32);33}3435#else3637void EnableFZ() {38// TODO39}4041void FPU_SetFastMode() {}4243#endif444546