~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to ext/native/math/math_util.cpp

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

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