~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to ext/armips/Archs/MIPS/MipsOpcodes.h

  • 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
#pragma once
 
2
#include "Mips.h"
 
3
 
 
4
#define MA_MIPS1                        0x0000001
 
5
#define MA_MIPS2                        0x0000002
 
6
#define MA_MIPS3                        0x0000004
 
7
#define MA_MIPS4                        0x0000008
 
8
#define MA_PS2                          0x0000010
 
9
#define MA_PSP                          0x0000020
 
10
 
 
11
#define MA_EXPSX                        0x0000100
 
12
#define MA_EXN64                        0x0000200
 
13
#define MA_EXPS2                        0x0000400
 
14
#define MA_EXPSP                        0x0000800
 
15
 
 
16
#define MO_IPCA                 0x00000001      // pc >> 2
 
17
#define MO_IPCR                 0x00000002      // PC, -> difference >> 2
 
18
#define MO_RSD                  0x00000004      // rs = rd
 
19
#define MO_RST                  0x00000008      // rs = rt
 
20
#define MO_RDT                  0x00000010      // rd = rt
 
21
#define MO_DELAY                0x00000020      // delay slot follows
 
22
#define MO_NODELAYSLOT  0x00000040      // can't be in a delay slot
 
23
#define MO_DELAYRT              0x00000080      // rt won't be available for one instruction
 
24
#define MO_IGNORERTD    0x00000100      // don't care for rt delay
 
25
#define MO_FRSD                 0x00000200      // float rs + rd
 
26
#define MO_IMMALIGNED   0x00000400      // immediate 4 byte aligned
 
27
#define MO_VFPU_MIXED   0x00000800      // mixed mode vfpu register
 
28
#define MO_VFPU_6BIT    0x00001000      // vfpu register can have 6 bits max
 
29
#define MO_VFPU_SINGLE  0x00002000      // single vfpu reg
 
30
#define MO_VFPU_QUAD    0x00004000      // quad vfpu reg
 
31
#define MO_VFPU                 0x00008000      // vfpu type opcode
 
32
#define MO_64BIT                0x00010000      // only available on 64 bit cpus
 
33
#define MO_FPU                  0x00020000      // only available with an fpu
 
34
#define MO_TRANSPOSE_VS 0x00040000      // matrix vs has to be transposed
 
35
#define MO_VFPU_PAIR    0x00080000      // pair vfpu reg
 
36
#define MO_VFPU_TRIPLE  0x00100000      // triple vfpu reg
 
37
 
 
38
#define BITFIELD(START,LENGTH,VALUE)    (((VALUE) & ((1 << (LENGTH)) - 1)) << (START))
 
39
#define MIPS_FUNC(VALUE)                                BITFIELD(0,6,(VALUE))
 
40
#define MIPS_SA(VALUE)                                  BITFIELD(6,5,(VALUE))
 
41
#define MIPS_SECFUNC(VALUE)                             MIPS_SA((VALUE))
 
42
#define MIPS_OP(VALUE)                                  BITFIELD(26,6,(VALUE))
 
43
 
 
44
#define MIPS_RS(VALUE)                                  BITFIELD(21,5,(VALUE))
 
45
#define MIPS_RT(VALUE)                                  BITFIELD(16,5,(VALUE))
 
46
#define MIPS_RD(VALUE)                                  BITFIELD(11,5,(VALUE))
 
47
#define MIPS_FS(VALUE)                                  MIPS_RD((VALUE))
 
48
#define MIPS_FT(VALUE)                                  MIPS_RT((VALUE))
 
49
#define MIPS_FD(VALUE)                                  MIPS_SA((VALUE))
 
50
 
 
51
#define MIPS_SPECIAL(VALUE)                             (MIPS_OP(0) | MIPS_FUNC(VALUE))
 
52
#define MIPS_REGIMM(VALUE)                              (MIPS_OP(1) | MIPS_RT(VALUE))
 
53
#define MIPS_COP0(VALUE)                                (MIPS_OP(16) | MIPS_RS(VALUE))
 
54
#define MIPS_COP1(VALUE)                                (MIPS_OP(17) | MIPS_RS(VALUE))
 
55
#define MIPS_COP1BC(VALUE)                              (MIPS_COP1(8) | MIPS_RT(VALUE))
 
56
#define MIPS_COP1S(VALUE)                               (MIPS_COP1(16) | MIPS_FUNC(VALUE))
 
57
#define MIPS_COP1W(VALUE)                               (MIPS_COP1(20) | MIPS_FUNC(VALUE))
 
58
 
 
59
#define MIPS_VFPUSIZE(VALUE)                    ( (((VALUE) & 1) << 7) | (((VALUE) & 2) << 14) )
 
60
#define MIPS_VFPUFUNC(VALUE)                    BITFIELD(23, 3, (VALUE))
 
61
#define MIPS_COP2(VALUE)                                (MIPS_OP(18) | MIPS_RS(VALUE))
 
62
#define MIPS_COP2BC(VALUE)                              (MIPS_COP2(8) | MIPS_RT(VALUE))
 
63
#define MIPS_VFPU0(VALUE)                               (MIPS_OP(24) | MIPS_VFPUFUNC(VALUE))
 
64
#define MIPS_VFPU1(VALUE)                               (MIPS_OP(25) | MIPS_VFPUFUNC(VALUE))
 
65
#define MIPS_VFPU3(VALUE)                               (MIPS_OP(27) | MIPS_VFPUFUNC(VALUE))
 
66
#define MIPS_SPECIAL3(VALUE)                    (MIPS_OP(31) | MIPS_FUNC(VALUE))
 
67
#define MIPS_ALLEGREX0(VALUE)                   (MIPS_SPECIAL3(32) | MIPS_SECFUNC(VALUE))
 
68
#define MIPS_VFPU4(VALUE)                               (MIPS_OP(52) | MIPS_RS(VALUE))
 
69
#define MIPS_VFPU4_11(VALUE)                    (MIPS_VFPU4(0) | MIPS_RT(VALUE))
 
70
#define MIPS_VFPU4_12(VALUE)                    (MIPS_VFPU4(1) | MIPS_RT(VALUE))
 
71
#define MIPS_VFPU4_13(VALUE)                    (MIPS_VFPU4(2) | MIPS_RT(VALUE))
 
72
#define MIPS_VFPU5(VALUE)                               (MIPS_OP(55) | MIPS_VFPUFUNC(VALUE))
 
73
#define MIPS_VFPU6(VALUE)                               (MIPS_OP(60) | MIPS_VFPUFUNC(VALUE))
 
74
#define MIPS_VFPU6_1(VALUE)                             (MIPS_VFPU6(7) | BITFIELD(20, 3, VALUE))
 
75
// This is a bit ugly, VFPU opcodes are encoded strangely.
 
76
#define MIPS_VFPU6_1VROT()                              (MIPS_VFPU6(7) | BITFIELD(21, 2, 1))
 
77
#define MIPS_VFPU6_2(VALUE)                             (MIPS_VFPU6_1(0) | MIPS_RT(VALUE))
 
78
 
 
79
 
 
80
struct MipsArchDefinition
 
81
{
 
82
        const char* name;
 
83
        int supportSets;
 
84
        int excludeMask;
 
85
        int flags;
 
86
};
 
87
 
 
88
extern const MipsArchDefinition mipsArchs[];
 
89
 
 
90
typedef struct {
 
91
        const char* name;
 
92
        const char* encoding;
 
93
        int destencoding;
 
94
        int archs;
 
95
        int flags;
 
96
} tMipsOpcode;
 
97
 
 
98
extern const tMipsOpcode MipsOpcodes[];