2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/Math/math_util.h"
|
2012-05-08 22:33:43 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-07-16 13:50:49 +00:00
|
|
|
// QNX can only use RunFast mode and it is already the default.
|
2016-10-11 16:48:49 +00:00
|
|
|
#if defined(__ARM_ARCH_7A__)
|
2014-07-16 13:50:49 +00:00
|
|
|
// Enables 'RunFast' VFP mode.
|
2014-03-23 09:04:25 +00:00
|
|
|
void EnableFZ() {
|
2012-10-30 12:20:55 +00:00
|
|
|
int x;
|
|
|
|
asm(
|
|
|
|
"fmrx %[result],FPSCR \r\n"
|
|
|
|
"orr %[result],%[result],#16777216 \r\n"
|
|
|
|
"fmxr FPSCR,%[result]"
|
|
|
|
:[result] "=r" (x) : :
|
|
|
|
);
|
|
|
|
//printf("ARM FPSCR: %08x\n",x);
|
2012-05-08 22:33:43 +00:00
|
|
|
}
|
2014-03-23 09:04:25 +00:00
|
|
|
|
2014-03-24 15:47:21 +00:00
|
|
|
// New fastmode code from: http://pandorawiki.org/Floating_Point_Optimization
|
|
|
|
// These settings turbocharge the slow VFP unit on Cortex-A8 based chips by setting
|
|
|
|
// restrictions that permit running VFP instructions on the NEON unit.
|
|
|
|
// Denormal flush-to-zero, for example.
|
2014-03-23 09:04:25 +00:00
|
|
|
void FPU_SetFastMode() {
|
2014-03-24 15:47:21 +00:00
|
|
|
static const unsigned int x = 0x04086060;
|
|
|
|
static const unsigned int y = 0x03000000;
|
|
|
|
int r;
|
|
|
|
asm volatile (
|
|
|
|
"fmrx %0, fpscr \n\t" //r0 = FPSCR
|
|
|
|
"and %0, %0, %1 \n\t" //r0 = r0 & 0x04086060
|
|
|
|
"orr %0, %0, %2 \n\t" //r0 = r0 | 0x03000000
|
|
|
|
"fmxr fpscr, %0 \n\t" //FPSCR = r0
|
|
|
|
: "=r"(r)
|
|
|
|
: "r"(x), "r"(y)
|
2014-03-23 09:04:25 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-05-08 22:33:43 +00:00
|
|
|
#else
|
2014-03-23 09:04:25 +00:00
|
|
|
|
|
|
|
void EnableFZ() {
|
2013-03-21 19:51:35 +00:00
|
|
|
// TODO
|
2012-05-08 22:33:43 +00:00
|
|
|
}
|
2014-03-23 09:04:25 +00:00
|
|
|
|
|
|
|
void FPU_SetFastMode() {}
|
|
|
|
|
2012-10-30 12:20:55 +00:00
|
|
|
#endif
|