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