Revision 0211e5af target-i386/op.c
b/target-i386/op.c | ||
---|---|---|
123 | 123 |
|
124 | 124 |
#endif |
125 | 125 |
|
126 |
/* multiply/divide */ |
|
127 |
|
|
128 |
/* XXX: add eflags optimizations */ |
|
129 |
/* XXX: add non P4 style flags */ |
|
130 |
|
|
131 |
void OPPROTO op_mulb_AL_T0(void) |
|
132 |
{ |
|
133 |
unsigned int res; |
|
134 |
res = (uint8_t)EAX * (uint8_t)T0; |
|
135 |
EAX = (EAX & ~0xffff) | res; |
|
136 |
CC_DST = res; |
|
137 |
CC_SRC = (res & 0xff00); |
|
138 |
} |
|
139 |
|
|
140 |
void OPPROTO op_imulb_AL_T0(void) |
|
141 |
{ |
|
142 |
int res; |
|
143 |
res = (int8_t)EAX * (int8_t)T0; |
|
144 |
EAX = (EAX & ~0xffff) | (res & 0xffff); |
|
145 |
CC_DST = res; |
|
146 |
CC_SRC = (res != (int8_t)res); |
|
147 |
} |
|
148 |
|
|
149 |
void OPPROTO op_mulw_AX_T0(void) |
|
150 |
{ |
|
151 |
unsigned int res; |
|
152 |
res = (uint16_t)EAX * (uint16_t)T0; |
|
153 |
EAX = (EAX & ~0xffff) | (res & 0xffff); |
|
154 |
EDX = (EDX & ~0xffff) | ((res >> 16) & 0xffff); |
|
155 |
CC_DST = res; |
|
156 |
CC_SRC = res >> 16; |
|
157 |
} |
|
158 |
|
|
159 |
void OPPROTO op_imulw_AX_T0(void) |
|
160 |
{ |
|
161 |
int res; |
|
162 |
res = (int16_t)EAX * (int16_t)T0; |
|
163 |
EAX = (EAX & ~0xffff) | (res & 0xffff); |
|
164 |
EDX = (EDX & ~0xffff) | ((res >> 16) & 0xffff); |
|
165 |
CC_DST = res; |
|
166 |
CC_SRC = (res != (int16_t)res); |
|
167 |
} |
|
168 |
|
|
169 |
void OPPROTO op_mull_EAX_T0(void) |
|
170 |
{ |
|
171 |
uint64_t res; |
|
172 |
res = (uint64_t)((uint32_t)EAX) * (uint64_t)((uint32_t)T0); |
|
173 |
EAX = (uint32_t)res; |
|
174 |
EDX = (uint32_t)(res >> 32); |
|
175 |
CC_DST = (uint32_t)res; |
|
176 |
CC_SRC = (uint32_t)(res >> 32); |
|
177 |
} |
|
178 |
|
|
179 |
void OPPROTO op_imull_EAX_T0(void) |
|
180 |
{ |
|
181 |
int64_t res; |
|
182 |
res = (int64_t)((int32_t)EAX) * (int64_t)((int32_t)T0); |
|
183 |
EAX = (uint32_t)(res); |
|
184 |
EDX = (uint32_t)(res >> 32); |
|
185 |
CC_DST = res; |
|
186 |
CC_SRC = (res != (int32_t)res); |
|
187 |
} |
|
188 |
|
|
189 |
void OPPROTO op_imulw_T0_T1(void) |
|
190 |
{ |
|
191 |
int res; |
|
192 |
res = (int16_t)T0 * (int16_t)T1; |
|
193 |
T0 = res; |
|
194 |
CC_DST = res; |
|
195 |
CC_SRC = (res != (int16_t)res); |
|
196 |
} |
|
197 |
|
|
198 |
void OPPROTO op_imull_T0_T1(void) |
|
199 |
{ |
|
200 |
int64_t res; |
|
201 |
res = (int64_t)((int32_t)T0) * (int64_t)((int32_t)T1); |
|
202 |
T0 = res; |
|
203 |
CC_DST = res; |
|
204 |
CC_SRC = (res != (int32_t)res); |
|
205 |
} |
|
206 |
|
|
207 |
#ifdef TARGET_X86_64 |
|
208 |
void OPPROTO op_mulq_EAX_T0(void) |
|
209 |
{ |
|
210 |
helper_mulq_EAX_T0(T0); |
|
211 |
} |
|
212 |
|
|
213 |
void OPPROTO op_imulq_EAX_T0(void) |
|
214 |
{ |
|
215 |
helper_imulq_EAX_T0(T0); |
|
216 |
} |
|
217 |
|
|
218 |
void OPPROTO op_imulq_T0_T1(void) |
|
219 |
{ |
|
220 |
T0 = helper_imulq_T0_T1(T0, T1); |
|
221 |
} |
|
222 |
#endif |
|
223 |
|
|
224 | 126 |
/* constant load & misc op */ |
225 | 127 |
|
226 | 128 |
/* XXX: consistent names */ |
Also available in: Unified diff