CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/Math/math_util.cpp
Views: 1401
1
#include "Common/Math/math_util.h"
2
#include <stdlib.h>
3
4
// QNX can only use RunFast mode and it is already the default.
5
#if defined(__ARM_ARCH_7A__)
6
// Enables 'RunFast' VFP mode.
7
void EnableFZ() {
8
int x;
9
asm(
10
"fmrx %[result],FPSCR \r\n"
11
"orr %[result],%[result],#16777216 \r\n"
12
"fmxr FPSCR,%[result]"
13
:[result] "=r" (x) : :
14
);
15
//printf("ARM FPSCR: %08x\n",x);
16
}
17
18
// New fastmode code from: http://pandorawiki.org/Floating_Point_Optimization
19
// These settings turbocharge the slow VFP unit on Cortex-A8 based chips by setting
20
// restrictions that permit running VFP instructions on the NEON unit.
21
// Denormal flush-to-zero, for example.
22
void FPU_SetFastMode() {
23
static const unsigned int x = 0x04086060;
24
static const unsigned int y = 0x03000000;
25
int r;
26
asm volatile (
27
"fmrx %0, fpscr \n\t" //r0 = FPSCR
28
"and %0, %0, %1 \n\t" //r0 = r0 & 0x04086060
29
"orr %0, %0, %2 \n\t" //r0 = r0 | 0x03000000
30
"fmxr fpscr, %0 \n\t" //FPSCR = r0
31
: "=r"(r)
32
: "r"(x), "r"(y)
33
);
34
}
35
36
#else
37
38
void EnableFZ() {
39
// TODO
40
}
41
42
void FPU_SetFastMode() {}
43
44
#endif
45
46