Commit b5075d29a88017705c252a0695f279f982f59a6f
1 parent
91caaa61
more imul tests
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@737 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
31 additions
and
0 deletions
tests/Makefile
... | ... | @@ -38,6 +38,10 @@ test: |
38 | 38 | endif |
39 | 39 | $(QEMU) test-i386 > test-i386.out |
40 | 40 | @if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi |
41 | +ifeq ($(ARCH),i386) | |
42 | + $(QEMU) -no-code-copy test-i386 > test-i386.out | |
43 | + @if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK (no code copy)"; fi | |
44 | +endif | |
41 | 45 | |
42 | 46 | # generic Linux and CPU test |
43 | 47 | linux-test: linux-test.c | ... | ... |
tests/test-i386.c
... | ... | @@ -401,6 +401,23 @@ void test_imull2(int op0, int op1) |
401 | 401 | "imull", s0, s1, res, flags & CC_MASK); |
402 | 402 | } |
403 | 403 | |
404 | +#define TEST_IMUL_IM(size, size1, op0, op1)\ | |
405 | +{\ | |
406 | + int res, flags;\ | |
407 | + flags = 0;\ | |
408 | + res = 0;\ | |
409 | + asm ("push %3\n\t"\ | |
410 | + "popf\n\t"\ | |
411 | + "imul" size " $" #op0 ", %" size1 "2, %" size1 "0\n\t" \ | |
412 | + "pushf\n\t"\ | |
413 | + "popl %1\n\t"\ | |
414 | + : "=r" (res), "=g" (flags)\ | |
415 | + : "r" (op1), "1" (flags), "0" (res));\ | |
416 | + printf("%-10s A=%08x B=%08x R=%08x CC=%04x\n",\ | |
417 | + "imul" size, op0, op1, res, flags & CC_MASK);\ | |
418 | +} | |
419 | + | |
420 | + | |
404 | 421 | #undef CC_MASK |
405 | 422 | #define CC_MASK (0) |
406 | 423 | |
... | ... | @@ -452,6 +469,16 @@ void test_mul(void) |
452 | 469 | test_imull2(0x80000000, 0x80000000); |
453 | 470 | test_imull2(0x10000, 0x10000); |
454 | 471 | |
472 | + TEST_IMUL_IM("w", "w", 45, 0x1234); | |
473 | + TEST_IMUL_IM("w", "w", -45, 23); | |
474 | + TEST_IMUL_IM("w", "w", 0x8000, 0x80000000); | |
475 | + TEST_IMUL_IM("w", "w", 0x7fff, 0x1000); | |
476 | + | |
477 | + TEST_IMUL_IM("l", "", 45, 0x1234); | |
478 | + TEST_IMUL_IM("l", "", -45, 23); | |
479 | + TEST_IMUL_IM("l", "", 0x8000, 0x80000000); | |
480 | + TEST_IMUL_IM("l", "", 0x7fff, 0x1000); | |
481 | + | |
455 | 482 | test_idivb(0x12341678, 0x127e); |
456 | 483 | test_idivb(0x43210123, -5); |
457 | 484 | test_idivb(0x12340004, -1); | ... | ... |