root / target-alpha / op_template.h @ 2d8ee4e7
History | View | Annotate | Download (3.3 kB)
1 |
/*
|
---|---|
2 |
* Alpha emulation cpu micro-operations templates for qemu.
|
3 |
*
|
4 |
* Copyright (c) 2007 Jocelyn Mayer
|
5 |
*
|
6 |
* This library is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU Lesser General Public
|
8 |
* License as published by the Free Software Foundation; either
|
9 |
* version 2 of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This library is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
* Lesser General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU Lesser General Public
|
17 |
* License along with this library; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 |
*/
|
20 |
|
21 |
/* Optimized constant loads */
|
22 |
#if REG < 3 |
23 |
void OPPROTO glue(op_reset_T, REG) (void) |
24 |
{ |
25 |
glue(T, REG) = 0;
|
26 |
RETURN(); |
27 |
} |
28 |
|
29 |
#if !defined(HOST_SPARC) && !defined(HOST_SPARC64)
|
30 |
void OPPROTO glue(op_reset_FT, REG) (void) |
31 |
{ |
32 |
glue(FT, REG) = 0;
|
33 |
RETURN(); |
34 |
} |
35 |
#else
|
36 |
void OPPROTO glue(op_reset_FT, REG) (void) |
37 |
{ |
38 |
glue(helper_reset_FT, REG)(); |
39 |
RETURN(); |
40 |
} |
41 |
#endif
|
42 |
|
43 |
/* XXX: This can be great on most RISC machines */
|
44 |
#if !defined(__i386__) && !defined(__x86_64__)
|
45 |
void OPPROTO glue(op_set_s16_T, REG) (void) |
46 |
{ |
47 |
glue(T, REG) = (int16_t)PARAM(1);
|
48 |
RETURN(); |
49 |
} |
50 |
|
51 |
void OPPROTO glue(op_set_u16_T, REG) (void) |
52 |
{ |
53 |
glue(T, REG) = (uint16_t)PARAM(1);
|
54 |
RETURN(); |
55 |
} |
56 |
#endif
|
57 |
|
58 |
void OPPROTO glue(op_set_s32_T, REG) (void) |
59 |
{ |
60 |
glue(T, REG) = (int32_t)PARAM(1);
|
61 |
RETURN(); |
62 |
} |
63 |
|
64 |
void OPPROTO glue(op_set_u32_T, REG) (void) |
65 |
{ |
66 |
glue(T, REG) = (uint32_t)PARAM(1);
|
67 |
RETURN(); |
68 |
} |
69 |
|
70 |
#if 0 // Qemu does not know how to do this...
|
71 |
void OPPROTO glue(op_set_64_T, REG) (void)
|
72 |
{
|
73 |
glue(T, REG) = (int64_t)PARAM(1);
|
74 |
RETURN();
|
75 |
}
|
76 |
#else
|
77 |
void OPPROTO glue(op_set_64_T, REG) (void) |
78 |
{ |
79 |
glue(T, REG) = ((int64_t)PARAM(1) << 32) | (int64_t)PARAM(2); |
80 |
RETURN(); |
81 |
} |
82 |
#endif
|
83 |
|
84 |
#endif /* REG < 3 */ |
85 |
|
86 |
/* Fixed-point register moves */
|
87 |
#if REG < 31 |
88 |
void OPPROTO glue(op_load_T0_ir, REG) (void) |
89 |
{ |
90 |
T0 = env->ir[REG]; |
91 |
RETURN(); |
92 |
} |
93 |
|
94 |
void OPPROTO glue(op_load_T1_ir, REG) (void) |
95 |
{ |
96 |
T1 = env->ir[REG]; |
97 |
RETURN(); |
98 |
} |
99 |
|
100 |
void OPPROTO glue(op_load_T2_ir, REG) (void) |
101 |
{ |
102 |
T2 = env->ir[REG]; |
103 |
RETURN(); |
104 |
} |
105 |
|
106 |
void OPPROTO glue(op_store_T0_ir, REG) (void) |
107 |
{ |
108 |
env->ir[REG] = T0; |
109 |
RETURN(); |
110 |
} |
111 |
|
112 |
void OPPROTO glue(op_store_T1_ir, REG) (void) |
113 |
{ |
114 |
env->ir[REG] = T1; |
115 |
RETURN(); |
116 |
} |
117 |
|
118 |
void OPPROTO glue(op_store_T2_ir, REG) (void) |
119 |
{ |
120 |
env->ir[REG] = T2; |
121 |
RETURN(); |
122 |
} |
123 |
|
124 |
void OPPROTO glue(op_cmov_ir, REG) (void) |
125 |
{ |
126 |
if (T0)
|
127 |
env->ir[REG] = T1; |
128 |
RETURN(); |
129 |
} |
130 |
|
131 |
/* floating point registers moves */
|
132 |
void OPPROTO glue(op_load_FT0_fir, REG) (void) |
133 |
{ |
134 |
FT0 = env->fir[REG]; |
135 |
RETURN(); |
136 |
} |
137 |
|
138 |
void OPPROTO glue(op_load_FT1_fir, REG) (void) |
139 |
{ |
140 |
FT1 = env->fir[REG]; |
141 |
RETURN(); |
142 |
} |
143 |
|
144 |
void OPPROTO glue(op_load_FT2_fir, REG) (void) |
145 |
{ |
146 |
FT2 = env->fir[REG]; |
147 |
RETURN(); |
148 |
} |
149 |
|
150 |
void OPPROTO glue(op_store_FT0_fir, REG) (void) |
151 |
{ |
152 |
env->fir[REG] = FT0; |
153 |
RETURN(); |
154 |
} |
155 |
|
156 |
void OPPROTO glue(op_store_FT1_fir, REG) (void) |
157 |
{ |
158 |
env->fir[REG] = FT1; |
159 |
RETURN(); |
160 |
} |
161 |
|
162 |
void OPPROTO glue(op_store_FT2_fir, REG) (void) |
163 |
{ |
164 |
env->fir[REG] = FT2; |
165 |
RETURN(); |
166 |
} |
167 |
|
168 |
void OPPROTO glue(op_cmov_fir, REG) (void) |
169 |
{ |
170 |
helper_cmov_fir(REG); |
171 |
RETURN(); |
172 |
} |
173 |
#endif /* REG < 31 */ |
174 |
|
175 |
#undef REG
|