root / target-mips / fop_template.c @ 179e32bb
History | View | Annotate | Download (3.1 kB)
1 |
/*
|
---|---|
2 |
* MIPS emulation micro-operations templates for floating point reg
|
3 |
* load & store for qemu.
|
4 |
*
|
5 |
* Copyright (c) 2006 Marius Groeger
|
6 |
*
|
7 |
* This library is free software; you can redistribute it and/or
|
8 |
* modify it under the terms of the GNU Lesser General Public
|
9 |
* License as published by the Free Software Foundation; either
|
10 |
* version 2 of the License, or (at your option) any later version.
|
11 |
*
|
12 |
* This library is distributed in the hope that it will be useful,
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 |
* Lesser General Public License for more details.
|
16 |
*
|
17 |
* You should have received a copy of the GNU Lesser General Public
|
18 |
* License along with this library; if not, write to the Free Software
|
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 |
*/
|
21 |
|
22 |
#if defined(SFREG)
|
23 |
|
24 |
#define OP_WLOAD_FREG(treg, tregname, SFREG) \
|
25 |
void glue(glue(op_load_fpr_,tregname), SFREG) (void) \ |
26 |
{ \ |
27 |
treg = FPR_W(env, SFREG); \ |
28 |
RETURN(); \ |
29 |
} |
30 |
|
31 |
#define OP_WSTORE_FREG(treg, tregname, SFREG) \
|
32 |
void glue(glue(op_store_fpr_,tregname), SFREG) (void)\ |
33 |
{ \ |
34 |
FPR_W(env, SFREG) = treg; \ |
35 |
RETURN(); \ |
36 |
} |
37 |
|
38 |
/* WT0 = SFREG.w: op_load_fpr_WT0_fprSFREG */
|
39 |
OP_WLOAD_FREG(WT0, WT0_fpr, SFREG) |
40 |
/* SFREG.w = WT0: op_store_fpr_WT0_fprSFREG */
|
41 |
OP_WSTORE_FREG(WT0, WT0_fpr, SFREG) |
42 |
|
43 |
OP_WLOAD_FREG(WT1, WT1_fpr, SFREG) |
44 |
OP_WSTORE_FREG(WT1, WT1_fpr, SFREG) |
45 |
|
46 |
OP_WLOAD_FREG(WT2, WT2_fpr, SFREG) |
47 |
OP_WSTORE_FREG(WT2, WT2_fpr, SFREG) |
48 |
|
49 |
#endif
|
50 |
|
51 |
#if defined(DFREG)
|
52 |
|
53 |
#define OP_DLOAD_FREG(treg, tregname, DFREG) \
|
54 |
void glue(glue(op_load_fpr_,tregname), DFREG) (void) \ |
55 |
{ \ |
56 |
treg = FPR_D(env, DFREG); \ |
57 |
RETURN(); \ |
58 |
} |
59 |
|
60 |
#define OP_DSTORE_FREG(treg, tregname, DFREG) \
|
61 |
void glue(glue(op_store_fpr_,tregname), DFREG) (void)\ |
62 |
{ \ |
63 |
FPR_D(env, DFREG) = treg; \ |
64 |
RETURN(); \ |
65 |
} |
66 |
|
67 |
OP_DLOAD_FREG(DT0, DT0_fpr, DFREG) |
68 |
OP_DSTORE_FREG(DT0, DT0_fpr, DFREG) |
69 |
|
70 |
OP_DLOAD_FREG(DT1, DT1_fpr, DFREG) |
71 |
OP_DSTORE_FREG(DT1, DT1_fpr, DFREG) |
72 |
|
73 |
OP_DLOAD_FREG(DT2, DT2_fpr, DFREG) |
74 |
OP_DSTORE_FREG(DT2, DT2_fpr, DFREG) |
75 |
|
76 |
#endif
|
77 |
|
78 |
#if defined (FTN)
|
79 |
|
80 |
#define SET_RESET(treg, tregname) \
|
81 |
void glue(op_set, tregname)(void) \ |
82 |
{ \ |
83 |
treg = PARAM1; \ |
84 |
RETURN(); \ |
85 |
} \ |
86 |
void glue(op_reset, tregname)(void) \ |
87 |
{ \ |
88 |
treg = 0; \
|
89 |
RETURN(); \ |
90 |
} \ |
91 |
|
92 |
SET_RESET(WT0, _WT0) |
93 |
SET_RESET(WT1, _WT1) |
94 |
SET_RESET(WT2, _WT2) |
95 |
SET_RESET(DT0, _DT0) |
96 |
SET_RESET(DT1, _DT1) |
97 |
SET_RESET(DT2, _DT2) |
98 |
|
99 |
#endif
|