]> git.proxmox.com Git - mirror_qemu.git/blob - target-alpha/op_template.h
Alpha architecture emulation core.
[mirror_qemu.git] / target-alpha / op_template.h
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 void OPPROTO glue(op_reset_FT, REG) (void)
30 {
31 glue(FT, REG) = 0;
32 RETURN();
33 }
34
35 /* XXX: This can be great on most RISC machines */
36 #if !defined(__i386__) && !defined(__x86_64__)
37 void OPPROTO glue(op_set_s16_T, REG) (void)
38 {
39 glue(T, REG) = (int16_t)PARAM(1);
40 RETURN();
41 }
42
43 void OPPROTO glue(op_set_u16_T, REG) (void)
44 {
45 glue(T, REG) = (uint16_t)PARAM(1);
46 RETURN();
47 }
48 #endif
49
50 void OPPROTO glue(op_set_s32_T, REG) (void)
51 {
52 glue(T, REG) = (int32_t)PARAM(1);
53 RETURN();
54 }
55
56 void OPPROTO glue(op_set_u32_T, REG) (void)
57 {
58 glue(T, REG) = (uint32_t)PARAM(1);
59 RETURN();
60 }
61
62 #if 0 // Qemu does not know how to do this...
63 void OPPROTO glue(op_set_64_T, REG) (void)
64 {
65 glue(T, REG) = (int64_t)PARAM(1);
66 RETURN();
67 }
68 #else
69 void OPPROTO glue(op_set_64_T, REG) (void)
70 {
71 glue(T, REG) = ((int64_t)PARAM(1) << 32) | (int64_t)PARAM(2);
72 RETURN();
73 }
74 #endif
75
76 #endif /* REG < 3 */
77
78 /* Fixed-point register moves */
79 #if REG < 31
80 void OPPROTO glue(op_load_T0_ir, REG) (void)
81 {
82 T0 = env->ir[REG];
83 RETURN();
84 }
85
86 void OPPROTO glue(op_load_T1_ir, REG) (void)
87 {
88 T1 = env->ir[REG];
89 RETURN();
90 }
91
92 void OPPROTO glue(op_load_T2_ir, REG) (void)
93 {
94 T2 = env->ir[REG];
95 RETURN();
96 }
97
98 void OPPROTO glue(op_store_T0_ir, REG) (void)
99 {
100 env->ir[REG] = T0;
101 RETURN();
102 }
103
104 void OPPROTO glue(op_store_T1_ir, REG) (void)
105 {
106 env->ir[REG] = T1;
107 RETURN();
108 }
109
110 void OPPROTO glue(op_store_T2_ir, REG) (void)
111 {
112 env->ir[REG] = T2;
113 RETURN();
114 }
115
116 void OPPROTO glue(op_cmov_ir, REG) (void)
117 {
118 if (T0)
119 env->ir[REG] = T1;
120 RETURN();
121 }
122
123 /* floating point registers moves */
124 void OPPROTO glue(op_load_FT0_fir, REG) (void)
125 {
126 FT0 = env->fir[REG];
127 RETURN();
128 }
129
130 void OPPROTO glue(op_load_FT1_fir, REG) (void)
131 {
132 FT1 = env->fir[REG];
133 RETURN();
134 }
135
136 void OPPROTO glue(op_load_FT2_fir, REG) (void)
137 {
138 FT2 = env->fir[REG];
139 RETURN();
140 }
141
142 void OPPROTO glue(op_store_FT0_fir, REG) (void)
143 {
144 env->fir[REG] = FT0;
145 RETURN();
146 }
147
148 void OPPROTO glue(op_store_FT1_fir, REG) (void)
149 {
150 env->fir[REG] = FT1;
151 RETURN();
152 }
153
154 void OPPROTO glue(op_store_FT2_fir, REG) (void)
155 {
156 env->fir[REG] = FT2;
157 RETURN();
158 }
159
160 void OPPROTO glue(op_cmov_fir, REG) (void)
161 {
162 helper_cmov_fir(REG);
163 RETURN();
164 }
165 #endif /* REG < 31 */
166
167 #undef REG