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