ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp
(Generate patch)

Comparing BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp (file contents):
Revision 1.6 by gbeauche, 2002-10-03T16:13:46Z vs.
Revision 1.14 by gbeauche, 2003-03-19T16:32:51Z

# Line 7 | Line 7
7   *    Gwenole Beauchesne
8   *
9   *  Basilisk II (C) 1997-2002 Christian Bauer
10 + *
11 + *  Portions related to CPU detection come from linux/arch/i386/kernel/setup.c
12   *  
13   *  This program is free software; you can redistribute it and/or modify
14   *  it under the terms of the GNU General Public License as published by
# Line 122 | Line 124 | uae_u8 need_to_preserve[]={1,1,1,1,0,1,1
124   #define CLOBBER_BT   clobber_flags()
125   #define CLOBBER_BSF  clobber_flags()
126  
127 + /* FIXME: disabled until that's proofread.  */
128 + #if 0
129 +
130 + #if defined(__x86_64__)
131 + #define X86_TARGET_64BIT                1
132 + #endif
133 + #define X86_FLAT_REGISTERS              0
134 + #define X86_OPTIMIZE_ALU                1
135 + #define X86_OPTIMIZE_ROTSHI             1
136 + #include "codegen_x86.h"
137 +
138 + #define x86_emit_byte(B)                emit_byte(B)
139 + #define x86_emit_word(W)                emit_word(W)
140 + #define x86_emit_long(L)                emit_long(L)
141 + #define x86_get_target()                get_target()
142 + #define x86_emit_failure(MSG)   jit_fail(MSG, __FILE__, __LINE__, __FUNCTION__)
143 +
144 + static void jit_fail(const char *msg, const char *file, int line, const char *function)
145 + {
146 +        fprintf(stderr, "JIT failure in function %s from file %s at line %d: %s\n",
147 +                        function, file, line, msg);
148 +        abort();
149 + }
150 +
151 + LOWFUNC(NONE,WRITE,1,raw_push_l_r,(R4 r))
152 + {
153 +        PUSHLr(r);
154 + }
155 + LENDFUNC(NONE,WRITE,1,raw_push_l_r,(R4 r))
156 +
157 + LOWFUNC(NONE,READ,1,raw_pop_l_r,(R4 r))
158 + {
159 +        POPLr(r);
160 + }
161 + LENDFUNC(NONE,READ,1,raw_pop_l_r,(R4 r))
162 +
163 + LOWFUNC(WRITE,NONE,2,raw_bt_l_ri,(R4 r, IMM i))
164 + {
165 +        BTLir(i, r);
166 + }
167 + LENDFUNC(WRITE,NONE,2,raw_bt_l_ri,(R4 r, IMM i))
168 +
169 + LOWFUNC(WRITE,NONE,2,raw_bt_l_rr,(R4 r, R4 b))
170 + {
171 +        BTLrr(b, r);
172 + }
173 + LENDFUNC(WRITE,NONE,2,raw_bt_l_rr,(R4 r, R4 b))
174 +
175 + LOWFUNC(WRITE,NONE,2,raw_btc_l_ri,(RW4 r, IMM i))
176 + {
177 +        BTCLir(i, r);
178 + }
179 + LENDFUNC(WRITE,NONE,2,raw_btc_l_ri,(RW4 r, IMM i))
180 +
181 + LOWFUNC(WRITE,NONE,2,raw_btc_l_rr,(RW4 r, R4 b))
182 + {
183 +        BTCLrr(b, r);
184 + }
185 + LENDFUNC(WRITE,NONE,2,raw_btc_l_rr,(RW4 r, R4 b))
186 +
187 + LOWFUNC(WRITE,NONE,2,raw_btr_l_ri,(RW4 r, IMM i))
188 + {
189 +        BTRLir(i, r);
190 + }
191 + LENDFUNC(WRITE,NONE,2,raw_btr_l_ri,(RW4 r, IMM i))
192 +
193 + LOWFUNC(WRITE,NONE,2,raw_btr_l_rr,(RW4 r, R4 b))
194 + {
195 +        BTRLrr(b, r);
196 + }
197 + LENDFUNC(WRITE,NONE,2,raw_btr_l_rr,(RW4 r, R4 b))
198 +
199 + LOWFUNC(WRITE,NONE,2,raw_bts_l_ri,(RW4 r, IMM i))
200 + {
201 +        BTSLir(i, r);
202 + }
203 + LENDFUNC(WRITE,NONE,2,raw_bts_l_ri,(RW4 r, IMM i))
204 +
205 + LOWFUNC(WRITE,NONE,2,raw_bts_l_rr,(RW4 r, R4 b))
206 + {
207 +        BTSLrr(b, r);
208 + }
209 + LENDFUNC(WRITE,NONE,2,raw_bts_l_rr,(RW4 r, R4 b))
210 +
211 + LOWFUNC(WRITE,NONE,2,raw_sub_w_ri,(RW2 d, IMM i))
212 + {
213 +        SUBWir(i, d);
214 + }
215 + LENDFUNC(WRITE,NONE,2,raw_sub_w_ri,(RW2 d, IMM i))
216 +
217 + LOWFUNC(NONE,READ,2,raw_mov_l_rm,(W4 d, MEMR s))
218 + {
219 +        MOVLmr(s, X86_NOREG, X86_NOREG, 1, d);
220 + }
221 + LENDFUNC(NONE,READ,2,raw_mov_l_rm,(W4 d, MEMR s))
222 +
223 + LOWFUNC(NONE,WRITE,2,raw_mov_l_mi,(MEMW d, IMM s))
224 + {
225 +        MOVLim(s, d, X86_NOREG, X86_NOREG, 1);
226 + }
227 + LENDFUNC(NONE,WRITE,2,raw_mov_l_mi,(MEMW d, IMM s))
228 +
229 + LOWFUNC(NONE,WRITE,2,raw_mov_w_mi,(MEMW d, IMM s))
230 + {
231 +        MOVWim(s, d, X86_NOREG, X86_NOREG, 1);
232 + }
233 + LENDFUNC(NONE,WRITE,2,raw_mov_w_mi,(MEMW d, IMM s))
234 +
235 + LOWFUNC(NONE,WRITE,2,raw_mov_b_mi,(MEMW d, IMM s))
236 + {
237 +        MOVBim(s, d, X86_NOREG, X86_NOREG, 1);
238 + }
239 + LENDFUNC(NONE,WRITE,2,raw_mov_b_mi,(MEMW d, IMM s))
240 +
241 + LOWFUNC(WRITE,RMW,2,raw_rol_b_mi,(MEMRW d, IMM i))
242 + {
243 +        ROLBim(i, d, X86_NOREG, X86_NOREG, 1);
244 + }
245 + LENDFUNC(WRITE,RMW,2,raw_rol_b_mi,(MEMRW d, IMM i))
246 +
247 + LOWFUNC(WRITE,NONE,2,raw_rol_b_ri,(RW1 r, IMM i))
248 + {
249 +        ROLBir(i, r);
250 + }
251 + LENDFUNC(WRITE,NONE,2,raw_rol_b_ri,(RW1 r, IMM i))
252 +
253 + LOWFUNC(WRITE,NONE,2,raw_rol_w_ri,(RW2 r, IMM i))
254 + {
255 +        ROLWir(i, r);
256 + }
257 + LENDFUNC(WRITE,NONE,2,raw_rol_w_ri,(RW2 r, IMM i))
258 +
259 + LOWFUNC(WRITE,NONE,2,raw_rol_l_ri,(RW4 r, IMM i))
260 + {
261 +        ROLLir(i, r);
262 + }
263 + LENDFUNC(WRITE,NONE,2,raw_rol_l_ri,(RW4 r, IMM i))
264 +
265 + LOWFUNC(WRITE,NONE,2,raw_rol_l_rr,(RW4 d, R1 r))
266 + {
267 +        ROLLrr(r, d);
268 + }
269 + LENDFUNC(WRITE,NONE,2,raw_rol_l_rr,(RW4 d, R1 r))
270 +
271 + LOWFUNC(WRITE,NONE,2,raw_rol_w_rr,(RW2 d, R1 r))
272 + {
273 +        ROLWrr(r, d);
274 + }
275 + LENDFUNC(WRITE,NONE,2,raw_rol_w_rr,(RW2 d, R1 r))
276 +
277 + LOWFUNC(WRITE,NONE,2,raw_rol_b_rr,(RW1 d, R1 r))
278 + {
279 +        ROLBrr(r, d);
280 + }
281 + LENDFUNC(WRITE,NONE,2,raw_rol_b_rr,(RW1 d, R1 r))
282 +
283 + LOWFUNC(WRITE,NONE,2,raw_shll_l_rr,(RW4 d, R1 r))
284 + {
285 +        SHLLrr(r, d);
286 + }
287 + LENDFUNC(WRITE,NONE,2,raw_shll_l_rr,(RW4 d, R1 r))
288 +
289 + LOWFUNC(WRITE,NONE,2,raw_shll_w_rr,(RW2 d, R1 r))
290 + {
291 +        SHLWrr(r, d);
292 + }
293 + LENDFUNC(WRITE,NONE,2,raw_shll_w_rr,(RW2 d, R1 r))
294 +
295 + LOWFUNC(WRITE,NONE,2,raw_shll_b_rr,(RW1 d, R1 r))
296 + {
297 +        SHLBrr(r, d);
298 + }
299 + LENDFUNC(WRITE,NONE,2,raw_shll_b_rr,(RW1 d, R1 r))
300 +
301 + LOWFUNC(WRITE,NONE,2,raw_ror_b_ri,(RW1 r, IMM i))
302 + {
303 +        RORBir(i, r);
304 + }
305 + LENDFUNC(WRITE,NONE,2,raw_ror_b_ri,(RW1 r, IMM i))
306 +
307 + LOWFUNC(WRITE,NONE,2,raw_ror_w_ri,(RW2 r, IMM i))
308 + {
309 +        RORWir(i, r);
310 + }
311 + LENDFUNC(WRITE,NONE,2,raw_ror_w_ri,(RW2 r, IMM i))
312 +
313 + LOWFUNC(WRITE,READ,2,raw_or_l_rm,(RW4 d, MEMR s))
314 + {
315 +        ORLmr(s, X86_NOREG, X86_NOREG, 1, d);
316 + }
317 + LENDFUNC(WRITE,READ,2,raw_or_l_rm,(RW4 d, MEMR s))
318 +
319 + LOWFUNC(WRITE,NONE,2,raw_ror_l_ri,(RW4 r, IMM i))
320 + {
321 +        RORLir(i, r);
322 + }
323 + LENDFUNC(WRITE,NONE,2,raw_ror_l_ri,(RW4 r, IMM i))
324 +
325 + LOWFUNC(WRITE,NONE,2,raw_ror_l_rr,(RW4 d, R1 r))
326 + {
327 +        RORLrr(r, d);
328 + }
329 + LENDFUNC(WRITE,NONE,2,raw_ror_l_rr,(RW4 d, R1 r))
330 +
331 + LOWFUNC(WRITE,NONE,2,raw_ror_w_rr,(RW2 d, R1 r))
332 + {
333 +        RORWrr(r, d);
334 + }
335 + LENDFUNC(WRITE,NONE,2,raw_ror_w_rr,(RW2 d, R1 r))
336 +
337 + LOWFUNC(WRITE,NONE,2,raw_ror_b_rr,(RW1 d, R1 r))
338 + {
339 +        RORBrr(r, d);
340 + }
341 + LENDFUNC(WRITE,NONE,2,raw_ror_b_rr,(RW1 d, R1 r))
342 +
343 + LOWFUNC(WRITE,NONE,2,raw_shrl_l_rr,(RW4 d, R1 r))
344 + {
345 +        SHRLrr(r, d);
346 + }
347 + LENDFUNC(WRITE,NONE,2,raw_shrl_l_rr,(RW4 d, R1 r))
348 +
349 + LOWFUNC(WRITE,NONE,2,raw_shrl_w_rr,(RW2 d, R1 r))
350 + {
351 +        SHRWrr(r, d);
352 + }
353 + LENDFUNC(WRITE,NONE,2,raw_shrl_w_rr,(RW2 d, R1 r))
354 +
355 + LOWFUNC(WRITE,NONE,2,raw_shrl_b_rr,(RW1 d, R1 r))
356 + {
357 +        SHRBrr(r, d);
358 + }
359 + LENDFUNC(WRITE,NONE,2,raw_shrl_b_rr,(RW1 d, R1 r))
360 +
361 + LOWFUNC(WRITE,NONE,2,raw_shra_l_rr,(RW4 d, R1 r))
362 + {
363 +        SARLrr(r, d);
364 + }
365 + LENDFUNC(WRITE,NONE,2,raw_shra_l_rr,(RW4 d, R1 r))
366 +
367 + LOWFUNC(WRITE,NONE,2,raw_shra_w_rr,(RW2 d, R1 r))
368 + {
369 +        SARWrr(r, d);
370 + }
371 + LENDFUNC(WRITE,NONE,2,raw_shra_w_rr,(RW2 d, R1 r))
372 +
373 + LOWFUNC(WRITE,NONE,2,raw_shra_b_rr,(RW1 d, R1 r))
374 + {
375 +        SARBrr(r, d);
376 + }
377 + LENDFUNC(WRITE,NONE,2,raw_shra_b_rr,(RW1 d, R1 r))
378 +
379 + LOWFUNC(WRITE,NONE,2,raw_shll_l_ri,(RW4 r, IMM i))
380 + {
381 +        SHLLir(i, r);
382 + }
383 + LENDFUNC(WRITE,NONE,2,raw_shll_l_ri,(RW4 r, IMM i))
384 +
385 + LOWFUNC(WRITE,NONE,2,raw_shll_w_ri,(RW2 r, IMM i))
386 + {
387 +        SHLWir(i, r);
388 + }
389 + LENDFUNC(WRITE,NONE,2,raw_shll_w_ri,(RW2 r, IMM i))
390 +
391 + LOWFUNC(WRITE,NONE,2,raw_shll_b_ri,(RW1 r, IMM i))
392 + {
393 +        SHLBir(i, r);
394 + }
395 + LENDFUNC(WRITE,NONE,2,raw_shll_b_ri,(RW1 r, IMM i))
396 +
397 + LOWFUNC(WRITE,NONE,2,raw_shrl_l_ri,(RW4 r, IMM i))
398 + {
399 +        SHRLir(i, r);
400 + }
401 + LENDFUNC(WRITE,NONE,2,raw_shrl_l_ri,(RW4 r, IMM i))
402 +
403 + LOWFUNC(WRITE,NONE,2,raw_shrl_w_ri,(RW2 r, IMM i))
404 + {
405 +        SHRWir(i, r);
406 + }
407 + LENDFUNC(WRITE,NONE,2,raw_shrl_w_ri,(RW2 r, IMM i))
408 +
409 + LOWFUNC(WRITE,NONE,2,raw_shrl_b_ri,(RW1 r, IMM i))
410 + {
411 +        SHRBir(i, r);
412 + }
413 + LENDFUNC(WRITE,NONE,2,raw_shrl_b_ri,(RW1 r, IMM i))
414 +
415 + LOWFUNC(WRITE,NONE,2,raw_shra_l_ri,(RW4 r, IMM i))
416 + {
417 +        SARLir(i, r);
418 + }
419 + LENDFUNC(WRITE,NONE,2,raw_shra_l_ri,(RW4 r, IMM i))
420 +
421 + LOWFUNC(WRITE,NONE,2,raw_shra_w_ri,(RW2 r, IMM i))
422 + {
423 +        SARWir(i, r);
424 + }
425 + LENDFUNC(WRITE,NONE,2,raw_shra_w_ri,(RW2 r, IMM i))
426 +
427 + LOWFUNC(WRITE,NONE,2,raw_shra_b_ri,(RW1 r, IMM i))
428 + {
429 +        SARBir(i, r);
430 + }
431 + LENDFUNC(WRITE,NONE,2,raw_shra_b_ri,(RW1 r, IMM i))
432 +
433 + LOWFUNC(WRITE,NONE,1,raw_sahf,(R2 dummy_ah))
434 + {
435 +        SAHF();
436 + }
437 + LENDFUNC(WRITE,NONE,1,raw_sahf,(R2 dummy_ah))
438 +
439 + LOWFUNC(NONE,NONE,1,raw_cpuid,(R4 dummy_eax))
440 + {
441 +        CPUID();
442 + }
443 + LENDFUNC(NONE,NONE,1,raw_cpuid,(R4 dummy_eax))
444 +
445 + LOWFUNC(READ,NONE,1,raw_lahf,(W2 dummy_ah))
446 + {
447 +        LAHF();
448 + }
449 + LENDFUNC(READ,NONE,1,raw_lahf,(W2 dummy_ah))
450 +
451 + LOWFUNC(READ,NONE,2,raw_setcc,(W1 d, IMM cc))
452 + {
453 +        SETCCir(cc, d);
454 + }
455 + LENDFUNC(READ,NONE,2,raw_setcc,(W1 d, IMM cc))
456 +
457 + LOWFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
458 + {
459 +        SETCCim(cc, d, X86_NOREG, X86_NOREG, 1);
460 + }
461 + LENDFUNC(READ,WRITE,2,raw_setcc_m,(MEMW d, IMM cc))
462 +
463 + LOWFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
464 + {
465 +        CMOVLrr(cc, s, d);
466 + }
467 + LENDFUNC(READ,NONE,3,raw_cmov_l_rr,(RW4 d, R4 s, IMM cc))
468 +
469 + LOWFUNC(WRITE,NONE,2,raw_bsf_l_rr,(W4 d, R4 s))
470 + {
471 +        BSFLrr(s, d);
472 + }
473 + LENDFUNC(WRITE,NONE,2,raw_bsf_l_rr,(W4 d, R4 s))
474 +
475 + LOWFUNC(NONE,NONE,2,raw_sign_extend_16_rr,(W4 d, R2 s))
476 + {
477 +        MOVSWLrr(s, d);
478 + }
479 + LENDFUNC(NONE,NONE,2,raw_sign_extend_16_rr,(W4 d, R2 s))
480 +
481 + LOWFUNC(NONE,NONE,2,raw_sign_extend_8_rr,(W4 d, R1 s))
482 + {
483 +        MOVSBLrr(s, d);
484 + }
485 + LENDFUNC(NONE,NONE,2,raw_sign_extend_8_rr,(W4 d, R1 s))
486 +
487 + LOWFUNC(NONE,NONE,2,raw_zero_extend_16_rr,(W4 d, R2 s))
488 + {
489 +        MOVZWLrr(s, d);
490 + }
491 + LENDFUNC(NONE,NONE,2,raw_zero_extend_16_rr,(W4 d, R2 s))
492 +
493 + LOWFUNC(NONE,NONE,2,raw_zero_extend_8_rr,(W4 d, R1 s))
494 + {
495 +        MOVZBLrr(s, d);
496 + }
497 + LENDFUNC(NONE,NONE,2,raw_zero_extend_8_rr,(W4 d, R1 s))
498 +
499 + LOWFUNC(NONE,NONE,2,raw_imul_32_32,(RW4 d, R4 s))
500 + {
501 +        IMULLrr(s, d);
502 + }
503 + LENDFUNC(NONE,NONE,2,raw_imul_32_32,(RW4 d, R4 s))
504 +
505 + LOWFUNC(NONE,NONE,2,raw_imul_64_32,(RW4 d, RW4 s))
506 + {
507 +        if (d!=MUL_NREG1 || s!=MUL_NREG2) {
508 +        write_log("Bad register in IMUL: d=%d, s=%d\n",d,s);
509 +        abort();
510 +        }
511 +        IMULLr(s);
512 + }
513 + LENDFUNC(NONE,NONE,2,raw_imul_64_32,(RW4 d, RW4 s))
514 +
515 + LOWFUNC(NONE,NONE,2,raw_mul_64_32,(RW4 d, RW4 s))
516 + {
517 +        if (d!=MUL_NREG1 || s!=MUL_NREG2) {
518 +        write_log("Bad register in MUL: d=%d, s=%d\n",d,s);
519 +        abort();
520 +        }
521 +        MULLr(s);
522 + }
523 + LENDFUNC(NONE,NONE,2,raw_mul_64_32,(RW4 d, RW4 s))
524 +
525 + LOWFUNC(NONE,NONE,2,raw_mul_32_32,(RW4 d, R4 s))
526 + {
527 +        abort(); /* %^$&%^$%#^ x86! */
528 + }
529 + LENDFUNC(NONE,NONE,2,raw_mul_32_32,(RW4 d, R4 s))
530 +
531 + LOWFUNC(NONE,NONE,2,raw_mov_b_rr,(W1 d, R1 s))
532 + {
533 +        MOVBrr(s, d);
534 + }
535 + LENDFUNC(NONE,NONE,2,raw_mov_b_rr,(W1 d, R1 s))
536 +
537 + LOWFUNC(NONE,NONE,2,raw_mov_w_rr,(W2 d, R2 s))
538 + {
539 +        MOVWrr(s, d);
540 + }
541 + LENDFUNC(NONE,NONE,2,raw_mov_w_rr,(W2 d, R2 s))
542 +
543 + LOWFUNC(NONE,READ,4,raw_mov_l_rrm_indexed,(W4 d,R4 baser, R4 index, IMM factor))
544 + {
545 +        MOVLmr(0, baser, index, factor, d);
546 + }
547 + LENDFUNC(NONE,READ,4,raw_mov_l_rrm_indexed,(W4 d,R4 baser, R4 index, IMM factor))
548 +
549 + LOWFUNC(NONE,READ,4,raw_mov_w_rrm_indexed,(W2 d, R4 baser, R4 index, IMM factor))
550 + {
551 +        MOVWmr(0, baser, index, factor, d);
552 + }
553 + LENDFUNC(NONE,READ,4,raw_mov_w_rrm_indexed,(W2 d, R4 baser, R4 index, IMM factor))
554 +
555 + LOWFUNC(NONE,READ,4,raw_mov_b_rrm_indexed,(W1 d, R4 baser, R4 index, IMM factor))
556 + {
557 +        MOVBmr(0, baser, index, factor, d);
558 + }
559 + LENDFUNC(NONE,READ,4,raw_mov_b_rrm_indexed,(W1 d, R4 baser, R4 index, IMM factor))
560 +
561 + LOWFUNC(NONE,WRITE,4,raw_mov_l_mrr_indexed,(R4 baser, R4 index, IMM factor, R4 s))
562 + {
563 +        MOVLrm(s, 0, baser, index, factor);
564 + }
565 + LENDFUNC(NONE,WRITE,4,raw_mov_l_mrr_indexed,(R4 baser, R4 index, IMM factor, R4 s))
566 +
567 + LOWFUNC(NONE,WRITE,4,raw_mov_w_mrr_indexed,(R4 baser, R4 index, IMM factor, R2 s))
568 + {
569 +        MOVWrm(s, 0, baser, index, factor);
570 + }
571 + LENDFUNC(NONE,WRITE,4,raw_mov_w_mrr_indexed,(R4 baser, R4 index, IMM factor, R2 s))
572 +
573 + LOWFUNC(NONE,WRITE,4,raw_mov_b_mrr_indexed,(R4 baser, R4 index, IMM factor, R1 s))
574 + {
575 +        MOVBrm(s, 0, baser, index, factor);
576 + }
577 + LENDFUNC(NONE,WRITE,4,raw_mov_b_mrr_indexed,(R4 baser, R4 index, IMM factor, R1 s))
578 +
579 + LOWFUNC(NONE,WRITE,5,raw_mov_l_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R4 s))
580 + {
581 +        MOVLrm(s, base, baser, index, factor);
582 + }
583 + LENDFUNC(NONE,WRITE,5,raw_mov_l_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R4 s))
584 +
585 + LOWFUNC(NONE,WRITE,5,raw_mov_w_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R2 s))
586 + {
587 +        MOVWrm(s, base, baser, index, factor);
588 + }
589 + LENDFUNC(NONE,WRITE,5,raw_mov_w_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R2 s))
590 +
591 + LOWFUNC(NONE,WRITE,5,raw_mov_b_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R1 s))
592 + {
593 +        MOVBrm(s, base, baser, index, factor);
594 + }
595 + LENDFUNC(NONE,WRITE,5,raw_mov_b_bmrr_indexed,(IMM base, R4 baser, R4 index, IMM factor, R1 s))
596 +
597 + LOWFUNC(NONE,READ,5,raw_mov_l_brrm_indexed,(W4 d, IMM base, R4 baser, R4 index, IMM factor))
598 + {
599 +        MOVLmr(base, baser, index, factor, d);
600 + }
601 + LENDFUNC(NONE,READ,5,raw_mov_l_brrm_indexed,(W4 d, IMM base, R4 baser, R4 index, IMM factor))
602 +
603 + LOWFUNC(NONE,READ,5,raw_mov_w_brrm_indexed,(W2 d, IMM base, R4 baser, R4 index, IMM factor))
604 + {
605 +        MOVWmr(base, baser, index, factor, d);
606 + }
607 + LENDFUNC(NONE,READ,5,raw_mov_w_brrm_indexed,(W2 d, IMM base, R4 baser, R4 index, IMM factor))
608 +
609 + LOWFUNC(NONE,READ,5,raw_mov_b_brrm_indexed,(W1 d, IMM base, R4 baser, R4 index, IMM factor))
610 + {
611 +        MOVBmr(base, baser, index, factor, d);
612 + }
613 + LENDFUNC(NONE,READ,5,raw_mov_b_brrm_indexed,(W1 d, IMM base, R4 baser, R4 index, IMM factor))
614 +
615 + LOWFUNC(NONE,READ,4,raw_mov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor))
616 + {
617 +        MOVLmr(base, X86_NOREG, index, factor, d);
618 + }
619 + LENDFUNC(NONE,READ,4,raw_mov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor))
620 +
621 + LOWFUNC(NONE,READ,5,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor, IMM cond))
622 + {
623 +        CMOVLmr(cond, base, X86_NOREG, index, factor, d);
624 + }
625 + LENDFUNC(NONE,READ,5,raw_cmov_l_rm_indexed,(W4 d, IMM base, R4 index, IMM factor, IMM cond))
626 +
627 + LOWFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
628 + {
629 +        CMOVLmr(cond, mem, X86_NOREG, X86_NOREG, 1, d);
630 + }
631 + LENDFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d, IMM mem, IMM cond))
632 +
633 + LOWFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
634 + {
635 +        MOVLmr(offset, s, X86_NOREG, 1, d);
636 + }
637 + LENDFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
638 +
639 + LOWFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
640 + {
641 +        MOVWmr(offset, s, X86_NOREG, 1, d);
642 + }
643 + LENDFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
644 +
645 + LOWFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
646 + {
647 +        MOVBmr(offset, s, X86_NOREG, 1, d);
648 + }
649 + LENDFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
650 +
651 + LOWFUNC(NONE,READ,3,raw_mov_l_brR,(W4 d, R4 s, IMM offset))
652 + {
653 +        MOVLmr(offset, s, X86_NOREG, 1, d);
654 + }
655 + LENDFUNC(NONE,READ,3,raw_mov_l_brR,(W4 d, R4 s, IMM offset))
656 +
657 + LOWFUNC(NONE,READ,3,raw_mov_w_brR,(W2 d, R4 s, IMM offset))
658 + {
659 +        MOVWmr(offset, s, X86_NOREG, 1, d);
660 + }
661 + LENDFUNC(NONE,READ,3,raw_mov_w_brR,(W2 d, R4 s, IMM offset))
662 +
663 + LOWFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d, R4 s, IMM offset))
664 + {
665 +        MOVBmr(offset, s, X86_NOREG, 1, d);
666 + }
667 + LENDFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d, R4 s, IMM offset))
668 +
669 + LOWFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
670 + {
671 +        MOVLim(i, offset, d, X86_NOREG, 1);
672 + }
673 + LENDFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
674 +
675 + LOWFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
676 + {
677 +        MOVWim(i, offset, d, X86_NOREG, 1);
678 + }
679 + LENDFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
680 +
681 + LOWFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
682 + {
683 +        MOVBim(i, offset, d, X86_NOREG, 1);
684 + }
685 + LENDFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
686 +
687 + LOWFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
688 + {
689 +        MOVLrm(s, offset, d, X86_NOREG, 1);
690 + }
691 + LENDFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
692 +
693 + LOWFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
694 + {
695 +        MOVWrm(s, offset, d, X86_NOREG, 1);
696 + }
697 + LENDFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
698 +
699 + LOWFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
700 + {
701 +        MOVBrm(s, offset, d, X86_NOREG, 1);
702 + }
703 + LENDFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
704 +
705 + LOWFUNC(NONE,NONE,3,raw_lea_l_brr,(W4 d, R4 s, IMM offset))
706 + {
707 +        LEALmr(offset, s, X86_NOREG, 1, d);
708 + }
709 + LENDFUNC(NONE,NONE,3,raw_lea_l_brr,(W4 d, R4 s, IMM offset))
710 +
711 + LOWFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
712 + {
713 +        LEALmr(offset, s, index, factor, d);
714 + }
715 + LENDFUNC(NONE,NONE,5,raw_lea_l_brr_indexed,(W4 d, R4 s, R4 index, IMM factor, IMM offset))
716 +
717 + LOWFUNC(NONE,NONE,4,raw_lea_l_rr_indexed,(W4 d, R4 s, R4 index, IMM factor))
718 + {
719 +        LEALmr(0, s, index, factor, d);
720 + }
721 + LENDFUNC(NONE,NONE,4,raw_lea_l_rr_indexed,(W4 d, R4 s, R4 index, IMM factor))
722 +
723 + LOWFUNC(NONE,WRITE,3,raw_mov_l_bRr,(R4 d, R4 s, IMM offset))
724 + {
725 +        MOVLrm(s, offset, d, X86_NOREG, 1);
726 + }
727 + LENDFUNC(NONE,WRITE,3,raw_mov_l_bRr,(R4 d, R4 s, IMM offset))
728 +
729 + LOWFUNC(NONE,WRITE,3,raw_mov_w_bRr,(R4 d, R2 s, IMM offset))
730 + {
731 +        MOVWrm(s, offset, d, X86_NOREG, 1);
732 + }
733 + LENDFUNC(NONE,WRITE,3,raw_mov_w_bRr,(R4 d, R2 s, IMM offset))
734 +
735 + LOWFUNC(NONE,WRITE,3,raw_mov_b_bRr,(R4 d, R1 s, IMM offset))
736 + {
737 +        MOVBrm(s, offset, d, X86_NOREG, 1);
738 + }
739 + LENDFUNC(NONE,WRITE,3,raw_mov_b_bRr,(R4 d, R1 s, IMM offset))
740 +
741 + LOWFUNC(NONE,NONE,1,raw_bswap_32,(RW4 r))
742 + {
743 +        BSWAPLr(r);
744 + }
745 + LENDFUNC(NONE,NONE,1,raw_bswap_32,(RW4 r))
746 +
747 + LOWFUNC(WRITE,NONE,1,raw_bswap_16,(RW2 r))
748 + {
749 +        ROLWir(8, r);
750 + }
751 + LENDFUNC(WRITE,NONE,1,raw_bswap_16,(RW2 r))
752 +
753 + LOWFUNC(NONE,NONE,2,raw_mov_l_rr,(W4 d, R4 s))
754 + {
755 +        MOVLrr(s, d);
756 + }
757 + LENDFUNC(NONE,NONE,2,raw_mov_l_rr,(W4 d, R4 s))
758 +
759 + LOWFUNC(NONE,WRITE,2,raw_mov_l_mr,(IMM d, R4 s))
760 + {
761 +        MOVLrm(s, d, X86_NOREG, X86_NOREG, 1);
762 + }
763 + LENDFUNC(NONE,WRITE,2,raw_mov_l_mr,(IMM d, R4 s))
764 +
765 + LOWFUNC(NONE,WRITE,2,raw_mov_w_mr,(IMM d, R2 s))
766 + {
767 +        MOVWrm(s, d, X86_NOREG, X86_NOREG, 1);
768 + }
769 + LENDFUNC(NONE,WRITE,2,raw_mov_w_mr,(IMM d, R2 s))
770 +
771 + LOWFUNC(NONE,READ,2,raw_mov_w_rm,(W2 d, IMM s))
772 + {
773 +        MOVWmr(s, X86_NOREG, X86_NOREG, 1, d);
774 + }
775 + LENDFUNC(NONE,READ,2,raw_mov_w_rm,(W2 d, IMM s))
776 +
777 + LOWFUNC(NONE,WRITE,2,raw_mov_b_mr,(IMM d, R1 s))
778 + {
779 +        MOVBrm(s, d, X86_NOREG, X86_NOREG, 1);
780 + }
781 + LENDFUNC(NONE,WRITE,2,raw_mov_b_mr,(IMM d, R1 s))
782 +
783 + LOWFUNC(NONE,READ,2,raw_mov_b_rm,(W1 d, IMM s))
784 + {
785 +        MOVBmr(s, X86_NOREG, X86_NOREG, 1, d);
786 + }
787 + LENDFUNC(NONE,READ,2,raw_mov_b_rm,(W1 d, IMM s))
788 +
789 + LOWFUNC(NONE,NONE,2,raw_mov_l_ri,(W4 d, IMM s))
790 + {
791 +        MOVLir(s, d);
792 + }
793 + LENDFUNC(NONE,NONE,2,raw_mov_l_ri,(W4 d, IMM s))
794 +
795 + LOWFUNC(NONE,NONE,2,raw_mov_w_ri,(W2 d, IMM s))
796 + {
797 +        MOVWir(s, d);
798 + }
799 + LENDFUNC(NONE,NONE,2,raw_mov_w_ri,(W2 d, IMM s))
800 +
801 + LOWFUNC(NONE,NONE,2,raw_mov_b_ri,(W1 d, IMM s))
802 + {
803 +        MOVBir(s, d);
804 + }
805 + LENDFUNC(NONE,NONE,2,raw_mov_b_ri,(W1 d, IMM s))
806 +
807 + LOWFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
808 + {
809 +        ADCLim(s, d, X86_NOREG, X86_NOREG, 1);
810 + }
811 + LENDFUNC(RMW,RMW,2,raw_adc_l_mi,(MEMRW d, IMM s))
812 +
813 + LOWFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
814 + {
815 +        ADDLim(s, d, X86_NOREG, X86_NOREG, 1);
816 + }
817 + LENDFUNC(WRITE,RMW,2,raw_add_l_mi,(IMM d, IMM s))
818 +
819 + LOWFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
820 + {
821 +        ADDWim(s, d, X86_NOREG, X86_NOREG, 1);
822 + }
823 + LENDFUNC(WRITE,RMW,2,raw_add_w_mi,(IMM d, IMM s))
824 +
825 + LOWFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
826 + {
827 +        ADDBim(s, d, X86_NOREG, X86_NOREG, 1);
828 + }
829 + LENDFUNC(WRITE,RMW,2,raw_add_b_mi,(IMM d, IMM s))
830 +
831 + LOWFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
832 + {
833 +        TESTLir(i, d);
834 + }
835 + LENDFUNC(WRITE,NONE,2,raw_test_l_ri,(R4 d, IMM i))
836 +
837 + LOWFUNC(WRITE,NONE,2,raw_test_l_rr,(R4 d, R4 s))
838 + {
839 +        TESTLrr(s, d);
840 + }
841 + LENDFUNC(WRITE,NONE,2,raw_test_l_rr,(R4 d, R4 s))
842 +
843 + LOWFUNC(WRITE,NONE,2,raw_test_w_rr,(R2 d, R2 s))
844 + {
845 +        TESTWrr(s, d);
846 + }
847 + LENDFUNC(WRITE,NONE,2,raw_test_w_rr,(R2 d, R2 s))
848 +
849 + LOWFUNC(WRITE,NONE,2,raw_test_b_rr,(R1 d, R1 s))
850 + {
851 +        TESTBrr(s, d);
852 + }
853 + LENDFUNC(WRITE,NONE,2,raw_test_b_rr,(R1 d, R1 s))
854 +
855 + LOWFUNC(WRITE,NONE,2,raw_and_l_ri,(RW4 d, IMM i))
856 + {
857 +        ANDLir(i, d);
858 + }
859 + LENDFUNC(WRITE,NONE,2,raw_and_l_ri,(RW4 d, IMM i))
860 +
861 + LOWFUNC(WRITE,NONE,2,raw_and_w_ri,(RW2 d, IMM i))
862 + {
863 +        ANDWir(i, d);
864 + }
865 + LENDFUNC(WRITE,NONE,2,raw_and_w_ri,(RW2 d, IMM i))
866 +
867 + LOWFUNC(WRITE,NONE,2,raw_and_l,(RW4 d, R4 s))
868 + {
869 +        ANDLrr(s, d);
870 + }
871 + LENDFUNC(WRITE,NONE,2,raw_and_l,(RW4 d, R4 s))
872 +
873 + LOWFUNC(WRITE,NONE,2,raw_and_w,(RW2 d, R2 s))
874 + {
875 +        ANDWrr(s, d);
876 + }
877 + LENDFUNC(WRITE,NONE,2,raw_and_w,(RW2 d, R2 s))
878 +
879 + LOWFUNC(WRITE,NONE,2,raw_and_b,(RW1 d, R1 s))
880 + {
881 +        ANDBrr(s, d);
882 + }
883 + LENDFUNC(WRITE,NONE,2,raw_and_b,(RW1 d, R1 s))
884 +
885 + LOWFUNC(WRITE,NONE,2,raw_or_l_ri,(RW4 d, IMM i))
886 + {
887 +        ORLir(i, d);
888 + }
889 + LENDFUNC(WRITE,NONE,2,raw_or_l_ri,(RW4 d, IMM i))
890 +
891 + LOWFUNC(WRITE,NONE,2,raw_or_l,(RW4 d, R4 s))
892 + {
893 +        ORLrr(s, d);
894 + }
895 + LENDFUNC(WRITE,NONE,2,raw_or_l,(RW4 d, R4 s))
896 +
897 + LOWFUNC(WRITE,NONE,2,raw_or_w,(RW2 d, R2 s))
898 + {
899 +        ORWrr(s, d);
900 + }
901 + LENDFUNC(WRITE,NONE,2,raw_or_w,(RW2 d, R2 s))
902 +
903 + LOWFUNC(WRITE,NONE,2,raw_or_b,(RW1 d, R1 s))
904 + {
905 +        ORBrr(s, d);
906 + }
907 + LENDFUNC(WRITE,NONE,2,raw_or_b,(RW1 d, R1 s))
908 +
909 + LOWFUNC(RMW,NONE,2,raw_adc_l,(RW4 d, R4 s))
910 + {
911 +        ADCLrr(s, d);
912 + }
913 + LENDFUNC(RMW,NONE,2,raw_adc_l,(RW4 d, R4 s))
914 +
915 + LOWFUNC(RMW,NONE,2,raw_adc_w,(RW2 d, R2 s))
916 + {
917 +        ADCWrr(s, d);
918 + }
919 + LENDFUNC(RMW,NONE,2,raw_adc_w,(RW2 d, R2 s))
920 +
921 + LOWFUNC(RMW,NONE,2,raw_adc_b,(RW1 d, R1 s))
922 + {
923 +        ADCBrr(s, d);
924 + }
925 + LENDFUNC(RMW,NONE,2,raw_adc_b,(RW1 d, R1 s))
926 +
927 + LOWFUNC(WRITE,NONE,2,raw_add_l,(RW4 d, R4 s))
928 + {
929 +        ADDLrr(s, d);
930 + }
931 + LENDFUNC(WRITE,NONE,2,raw_add_l,(RW4 d, R4 s))
932 +
933 + LOWFUNC(WRITE,NONE,2,raw_add_w,(RW2 d, R2 s))
934 + {
935 +        ADDWrr(s, d);
936 + }
937 + LENDFUNC(WRITE,NONE,2,raw_add_w,(RW2 d, R2 s))
938 +
939 + LOWFUNC(WRITE,NONE,2,raw_add_b,(RW1 d, R1 s))
940 + {
941 +        ADDBrr(s, d);
942 + }
943 + LENDFUNC(WRITE,NONE,2,raw_add_b,(RW1 d, R1 s))
944 +
945 + LOWFUNC(WRITE,NONE,2,raw_sub_l_ri,(RW4 d, IMM i))
946 + {
947 +        SUBLir(i, d);
948 + }
949 + LENDFUNC(WRITE,NONE,2,raw_sub_l_ri,(RW4 d, IMM i))
950 +
951 + LOWFUNC(WRITE,NONE,2,raw_sub_b_ri,(RW1 d, IMM i))
952 + {
953 +        SUBBir(i, d);
954 + }
955 + LENDFUNC(WRITE,NONE,2,raw_sub_b_ri,(RW1 d, IMM i))
956 +
957 + LOWFUNC(WRITE,NONE,2,raw_add_l_ri,(RW4 d, IMM i))
958 + {
959 +        ADDLir(i, d);
960 + }
961 + LENDFUNC(WRITE,NONE,2,raw_add_l_ri,(RW4 d, IMM i))
962 +
963 + LOWFUNC(WRITE,NONE,2,raw_add_w_ri,(RW2 d, IMM i))
964 + {
965 +        ADDWir(i, d);
966 + }
967 + LENDFUNC(WRITE,NONE,2,raw_add_w_ri,(RW2 d, IMM i))
968 +
969 + LOWFUNC(WRITE,NONE,2,raw_add_b_ri,(RW1 d, IMM i))
970 + {
971 +        ADDBir(i, d);
972 + }
973 + LENDFUNC(WRITE,NONE,2,raw_add_b_ri,(RW1 d, IMM i))
974 +
975 + LOWFUNC(RMW,NONE,2,raw_sbb_l,(RW4 d, R4 s))
976 + {
977 +        SBBLrr(s, d);
978 + }
979 + LENDFUNC(RMW,NONE,2,raw_sbb_l,(RW4 d, R4 s))
980 +
981 + LOWFUNC(RMW,NONE,2,raw_sbb_w,(RW2 d, R2 s))
982 + {
983 +        SBBWrr(s, d);
984 + }
985 + LENDFUNC(RMW,NONE,2,raw_sbb_w,(RW2 d, R2 s))
986 +
987 + LOWFUNC(RMW,NONE,2,raw_sbb_b,(RW1 d, R1 s))
988 + {
989 +        SBBBrr(s, d);
990 + }
991 + LENDFUNC(RMW,NONE,2,raw_sbb_b,(RW1 d, R1 s))
992 +
993 + LOWFUNC(WRITE,NONE,2,raw_sub_l,(RW4 d, R4 s))
994 + {
995 +        SUBLrr(s, d);
996 + }
997 + LENDFUNC(WRITE,NONE,2,raw_sub_l,(RW4 d, R4 s))
998 +
999 + LOWFUNC(WRITE,NONE,2,raw_sub_w,(RW2 d, R2 s))
1000 + {
1001 +        SUBWrr(s, d);
1002 + }
1003 + LENDFUNC(WRITE,NONE,2,raw_sub_w,(RW2 d, R2 s))
1004 +
1005 + LOWFUNC(WRITE,NONE,2,raw_sub_b,(RW1 d, R1 s))
1006 + {
1007 +        SUBBrr(s, d);
1008 + }
1009 + LENDFUNC(WRITE,NONE,2,raw_sub_b,(RW1 d, R1 s))
1010 +
1011 + LOWFUNC(WRITE,NONE,2,raw_cmp_l,(R4 d, R4 s))
1012 + {
1013 +        CMPLrr(s, d);
1014 + }
1015 + LENDFUNC(WRITE,NONE,2,raw_cmp_l,(R4 d, R4 s))
1016 +
1017 + LOWFUNC(WRITE,NONE,2,raw_cmp_l_ri,(R4 r, IMM i))
1018 + {
1019 +        CMPLir(i, r);
1020 + }
1021 + LENDFUNC(WRITE,NONE,2,raw_cmp_l_ri,(R4 r, IMM i))
1022 +
1023 + LOWFUNC(WRITE,NONE,2,raw_cmp_w,(R2 d, R2 s))
1024 + {
1025 +        CMPWrr(s, d);
1026 + }
1027 + LENDFUNC(WRITE,NONE,2,raw_cmp_w,(R2 d, R2 s))
1028 +
1029 + LOWFUNC(WRITE,READ,2,raw_cmp_b_mi,(MEMR d, IMM s))
1030 + {
1031 +        CMPBim(s, d, X86_NOREG, X86_NOREG, 1);
1032 + }
1033 + LENDFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
1034 +
1035 + LOWFUNC(WRITE,NONE,2,raw_cmp_b_ri,(R1 d, IMM i))
1036 + {
1037 +        CMPBir(i, d);
1038 + }
1039 + LENDFUNC(WRITE,NONE,2,raw_cmp_b_ri,(R1 d, IMM i))
1040 +
1041 + LOWFUNC(WRITE,NONE,2,raw_cmp_b,(R1 d, R1 s))
1042 + {
1043 +        CMPBrr(s, d);
1044 + }
1045 + LENDFUNC(WRITE,NONE,2,raw_cmp_b,(R1 d, R1 s))
1046 +
1047 + LOWFUNC(WRITE,READ,4,raw_cmp_l_rm_indexed,(R4 d, IMM offset, R4 index, IMM factor))
1048 + {
1049 +        CMPLmr(offset, X86_NOREG, index, factor, d);
1050 + }
1051 + LENDFUNC(WRITE,READ,4,raw_cmp_l_rm_indexed,(R4 d, IMM offset, R4 index, IMM factor))
1052 +
1053 + LOWFUNC(WRITE,NONE,2,raw_xor_l,(RW4 d, R4 s))
1054 + {
1055 +        XORLrr(s, d);
1056 + }
1057 + LENDFUNC(WRITE,NONE,2,raw_xor_l,(RW4 d, R4 s))
1058 +
1059 + LOWFUNC(WRITE,NONE,2,raw_xor_w,(RW2 d, R2 s))
1060 + {
1061 +        XORWrr(s, d);
1062 + }
1063 + LENDFUNC(WRITE,NONE,2,raw_xor_w,(RW2 d, R2 s))
1064 +
1065 + LOWFUNC(WRITE,NONE,2,raw_xor_b,(RW1 d, R1 s))
1066 + {
1067 +        XORBrr(s, d);
1068 + }
1069 + LENDFUNC(WRITE,NONE,2,raw_xor_b,(RW1 d, R1 s))
1070 +
1071 + LOWFUNC(WRITE,RMW,2,raw_sub_l_mi,(MEMRW d, IMM s))
1072 + {
1073 +        SUBLim(s, d, X86_NOREG, X86_NOREG, 1);
1074 + }
1075 + LENDFUNC(WRITE,RMW,2,raw_sub_l_mi,(MEMRW d, IMM s))
1076 +
1077 + LOWFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
1078 + {
1079 +        CMPLim(s, d, X86_NOREG, X86_NOREG, 1);
1080 + }
1081 + LENDFUNC(WRITE,READ,2,raw_cmp_l_mi,(MEMR d, IMM s))
1082 +
1083 + LOWFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
1084 + {
1085 +        XCHGLrr(r2, r1);
1086 + }
1087 + LENDFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
1088 +
1089 + LOWFUNC(READ,WRITE,0,raw_pushfl,(void))
1090 + {
1091 +        PUSHFD();
1092 + }
1093 + LENDFUNC(READ,WRITE,0,raw_pushfl,(void))
1094 +
1095 + LOWFUNC(WRITE,READ,0,raw_popfl,(void))
1096 + {
1097 +        POPFD();
1098 + }
1099 + LENDFUNC(WRITE,READ,0,raw_popfl,(void))
1100 +
1101 + #else
1102 +
1103   const bool optimize_accum               = true;
1104   const bool optimize_imm8                = true;
1105   const bool optimize_shift_once  = true;
# Line 1071 | Line 2049 | LENDFUNC(NONE,READ,3,raw_cmov_l_rm,(W4 d
2049  
2050   LOWFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d, R4 s, IMM offset))
2051   {
2052 +        Dif(!isbyte(offset)) abort();
2053      emit_byte(0x8b);
2054      emit_byte(0x40+8*d+s);
2055      emit_byte(offset);
# Line 1079 | Line 2058 | LENDFUNC(NONE,READ,3,raw_mov_l_rR,(W4 d,
2058  
2059   LOWFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d, R4 s, IMM offset))
2060   {
2061 +        Dif(!isbyte(offset)) abort();
2062      emit_byte(0x66);
2063      emit_byte(0x8b);
2064      emit_byte(0x40+8*d+s);
# Line 1088 | Line 2068 | LENDFUNC(NONE,READ,3,raw_mov_w_rR,(W2 d,
2068  
2069   LOWFUNC(NONE,READ,3,raw_mov_b_rR,(W1 d, R4 s, IMM offset))
2070   {
2071 +        Dif(!isbyte(offset)) abort();
2072      emit_byte(0x8a);
2073      emit_byte(0x40+8*d+s);
2074      emit_byte(offset);
# Line 1121 | Line 2102 | LENDFUNC(NONE,READ,3,raw_mov_b_brR,(W1 d
2102  
2103   LOWFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d, IMM i, IMM offset))
2104   {
2105 +        Dif(!isbyte(offset)) abort();
2106      emit_byte(0xc7);
2107      emit_byte(0x40+d);
2108      emit_byte(offset);
# Line 1130 | Line 2112 | LENDFUNC(NONE,WRITE,3,raw_mov_l_Ri,(R4 d
2112  
2113   LOWFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d, IMM i, IMM offset))
2114   {
2115 +        Dif(!isbyte(offset)) abort();
2116      emit_byte(0x66);
2117      emit_byte(0xc7);
2118      emit_byte(0x40+d);
# Line 1140 | Line 2123 | LENDFUNC(NONE,WRITE,3,raw_mov_w_Ri,(R4 d
2123  
2124   LOWFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d, IMM i, IMM offset))
2125   {
2126 +        Dif(!isbyte(offset)) abort();
2127      emit_byte(0xc6);
2128      emit_byte(0x40+d);
2129      emit_byte(offset);
# Line 1149 | Line 2133 | LENDFUNC(NONE,WRITE,3,raw_mov_b_Ri,(R4 d
2133  
2134   LOWFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d, R4 s, IMM offset))
2135   {
2136 +        Dif(!isbyte(offset)) abort();
2137      emit_byte(0x89);
2138      emit_byte(0x40+8*s+d);
2139      emit_byte(offset);
# Line 1157 | Line 2142 | LENDFUNC(NONE,WRITE,3,raw_mov_l_Rr,(R4 d
2142  
2143   LOWFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d, R2 s, IMM offset))
2144   {
2145 +        Dif(!isbyte(offset)) abort();
2146      emit_byte(0x66);
2147      emit_byte(0x89);
2148      emit_byte(0x40+8*s+d);
# Line 1166 | Line 2152 | LENDFUNC(NONE,WRITE,3,raw_mov_w_Rr,(R4 d
2152  
2153   LOWFUNC(NONE,WRITE,3,raw_mov_b_Rr,(R4 d, R1 s, IMM offset))
2154   {
2155 +        Dif(!isbyte(offset)) abort();
2156      emit_byte(0x88);
2157      emit_byte(0x40+8*s+d);
2158      emit_byte(offset);
# Line 1856 | Line 2843 | LOWFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r
2843   LENDFUNC(NONE,NONE,2,raw_xchg_l_rr,(RW4 r1, RW4 r2))
2844  
2845   /*************************************************************************
1859 * FIXME: string-related instructions                                    *
1860 *************************************************************************/
1861
1862 LOWFUNC(WRITE,NONE,0,raw_cld,(void))
1863 {
1864        emit_byte(0xfc);
1865 }
1866 LENDFUNC(WRITE,NONE,0,raw_cld,(void))
1867
1868 LOWFUNC(WRITE,NONE,0,raw_std,(void))
1869 {
1870        emit_byte(0xfd);
1871 }
1872 LENDFUNC(WRITE,NONE,0,raw_std,(void))
1873
1874 LOWFUNC(NONE,RMW,0,raw_movs_b,(void))
1875 {
1876        emit_byte(0xa4);
1877 }
1878 LENDFUNC(NONE,RMW,0,raw_movs_b,(void))
1879
1880 LOWFUNC(NONE,RMW,0,raw_movs_l,(void))
1881 {
1882        emit_byte(0xa5);
1883 }
1884 LENDFUNC(NONE,RMW,0,raw_movs_l,(void))
1885
1886 LOWFUNC(NONE,RMW,0,raw_rep,(void))
1887 {
1888        emit_byte(0xf3);
1889 }
1890 LENDFUNC(NONE,RMW,0,raw_rep,(void))
1891
1892 LOWFUNC(NONE,RMW,0,raw_rep_movsb,(void))
1893 {
1894        raw_rep();
1895        raw_movs_b();
1896 }
1897 LENDFUNC(NONE,RMW,0,raw_rep_movsb,(void))
1898
1899 LOWFUNC(NONE,RMW,0,raw_rep_movsl,(void))
1900 {
1901        raw_rep();
1902        raw_movs_l();
1903 }
1904 LENDFUNC(NONE,RMW,0,raw_rep_movsl,(void))
1905
1906 /*************************************************************************
2846   * FIXME: mem access modes probably wrong                                *
2847   *************************************************************************/
2848  
# Line 1919 | Line 2858 | LOWFUNC(WRITE,READ,0,raw_popfl,(void))
2858   }
2859   LENDFUNC(WRITE,READ,0,raw_popfl,(void))
2860  
2861 + #endif
2862 +
2863   /*************************************************************************
2864   * Unoptimizable stuff --- jump                                          *
2865   *************************************************************************/
# Line 2055 | Line 2996 | static __inline__ void raw_nop(void)
2996      emit_byte(0x90);
2997   }
2998  
2999 + static __inline__ void raw_emit_nop_filler(int nbytes)
3000 + {
3001 +  /* Source: GNU Binutils 2.12.90.0.15 */
3002 +  /* Various efficient no-op patterns for aligning code labels.
3003 +     Note: Don't try to assemble the instructions in the comments.
3004 +     0L and 0w are not legal.  */
3005 +  static const uae_u8 f32_1[] =
3006 +    {0x90};                                                                     /* nop                                  */
3007 +  static const uae_u8 f32_2[] =
3008 +    {0x89,0xf6};                                                        /* movl %esi,%esi               */
3009 +  static const uae_u8 f32_3[] =
3010 +    {0x8d,0x76,0x00};                                           /* leal 0(%esi),%esi    */
3011 +  static const uae_u8 f32_4[] =
3012 +    {0x8d,0x74,0x26,0x00};                                      /* leal 0(%esi,1),%esi  */
3013 +  static const uae_u8 f32_5[] =
3014 +    {0x90,                                                                      /* nop                                  */
3015 +     0x8d,0x74,0x26,0x00};                                      /* leal 0(%esi,1),%esi  */
3016 +  static const uae_u8 f32_6[] =
3017 +    {0x8d,0xb6,0x00,0x00,0x00,0x00};            /* leal 0L(%esi),%esi   */
3018 +  static const uae_u8 f32_7[] =
3019 +    {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};       /* leal 0L(%esi,1),%esi */
3020 +  static const uae_u8 f32_8[] =
3021 +    {0x90,                                                                      /* nop                                  */
3022 +     0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};       /* leal 0L(%esi,1),%esi */
3023 +  static const uae_u8 f32_9[] =
3024 +    {0x89,0xf6,                                                         /* movl %esi,%esi               */
3025 +     0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};       /* leal 0L(%edi,1),%edi */
3026 +  static const uae_u8 f32_10[] =
3027 +    {0x8d,0x76,0x00,                                            /* leal 0(%esi),%esi    */
3028 +     0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};       /* leal 0L(%edi,1),%edi */
3029 +  static const uae_u8 f32_11[] =
3030 +    {0x8d,0x74,0x26,0x00,                                       /* leal 0(%esi,1),%esi  */
3031 +     0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};       /* leal 0L(%edi,1),%edi */
3032 +  static const uae_u8 f32_12[] =
3033 +    {0x8d,0xb6,0x00,0x00,0x00,0x00,                     /* leal 0L(%esi),%esi   */
3034 +     0x8d,0xbf,0x00,0x00,0x00,0x00};            /* leal 0L(%edi),%edi   */
3035 +  static const uae_u8 f32_13[] =
3036 +    {0x8d,0xb6,0x00,0x00,0x00,0x00,                     /* leal 0L(%esi),%esi   */
3037 +     0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};       /* leal 0L(%edi,1),%edi */
3038 +  static const uae_u8 f32_14[] =
3039 +    {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00,        /* leal 0L(%esi,1),%esi */
3040 +     0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};       /* leal 0L(%edi,1),%edi */
3041 +  static const uae_u8 f32_15[] =
3042 +    {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90,        /* jmp .+15; lotsa nops */
3043 +     0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90};
3044 +  static const uae_u8 f32_16[] =
3045 +    {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90,        /* jmp .+15; lotsa nops */
3046 +     0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90};
3047 +  static const uae_u8 *const f32_patt[] = {
3048 +    f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8,
3049 +    f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15
3050 +  };
3051 +
3052 +  int nloops = nbytes / 16;
3053 +  while (nloops-- > 0)
3054 +        emit_block(f32_16, sizeof(f32_16));
3055 +
3056 +  nbytes %= 16;
3057 +  if (nbytes)
3058 +        emit_block(f32_patt[nbytes - 1], nbytes);
3059 + }
3060 +
3061  
3062   /*************************************************************************
3063   * Flag handling, to and fro UAE flag register                           *
# Line 2143 | Line 3146 | static __inline__ void raw_load_flagx(ua
3146          raw_mov_l_rm(target,(uae_u32)live.state[r].mem);
3147   }
3148  
3149 + #define NATIVE_FLAG_Z 0x40
3150 + static __inline__ void raw_flags_set_zero(int f, int r, int t)
3151 + {
3152 +        // FIXME: this is really suboptimal
3153 +        raw_pushfl();
3154 +        raw_pop_l_r(f);
3155 +        raw_and_l_ri(f,~NATIVE_FLAG_Z);
3156 +        raw_test_l_rr(r,r);
3157 +        raw_mov_l_ri(r,0);
3158 +        raw_mov_l_ri(t,NATIVE_FLAG_Z);
3159 +        raw_cmov_l_rr(r,t,NATIVE_CC_EQ);
3160 +        raw_or_l(f,r);
3161 +        raw_push_l_r(f);
3162 +        raw_popfl();
3163 + }
3164  
3165   static __inline__ void raw_inc_sp(int off)
3166   {
# Line 2618 | Line 3636 | raw_init_cpu(void)
3636                          x86_processor_string_table[c->x86_processor]);
3637   }
3638  
3639 + static bool target_check_bsf(void)
3640 + {
3641 +        bool mismatch = false;
3642 +        for (int g_ZF = 0; g_ZF <= 1; g_ZF++) {
3643 +        for (int g_CF = 0; g_CF <= 1; g_CF++) {
3644 +        for (int g_OF = 0; g_OF <= 1; g_OF++) {
3645 +        for (int g_SF = 0; g_SF <= 1; g_SF++) {
3646 +                for (int value = -1; value <= 1; value++) {
3647 +                        int flags = (g_SF << 7) | (g_OF << 11) | (g_ZF << 6) | g_CF;
3648 +                        int tmp = value;
3649 +                        __asm__ __volatile__ ("push %0; popf; bsf %1,%1; pushf; pop %0"
3650 +                                                                  : "+r" (flags), "+r" (tmp) : : "cc");
3651 +                        int OF = (flags >> 11) & 1;
3652 +                        int SF = (flags >>  7) & 1;
3653 +                        int ZF = (flags >>  6) & 1;
3654 +                        int CF = flags & 1;
3655 +                        tmp = (value == 0);
3656 +                        if (ZF != tmp || SF != g_SF || OF != g_OF || CF != g_CF)
3657 +                                mismatch = true;
3658 +                }
3659 +        }}}}
3660 +        if (mismatch)
3661 +                write_log("Target CPU defines all flags on BSF instruction\n");
3662 +        return !mismatch;
3663 + }
3664 +
3665  
3666   /*************************************************************************
3667   * FPU stuff                                                             *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines