Commit 75175024757fd716dc0f8d50d9a8837b6d88143d
1 parent
8f2b1fb0
fcmovx support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@464 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
40 additions
and
0 deletions
tests/test-i386.c
... | ... | @@ -658,6 +658,43 @@ void test_fenv(void) |
658 | 658 | TEST_ENV(&float_env32, ""); |
659 | 659 | } |
660 | 660 | |
661 | + | |
662 | +#define TEST_FCMOV(a, b, eflags, CC)\ | |
663 | +{\ | |
664 | + double res;\ | |
665 | + asm("push %3\n"\ | |
666 | + "popf\n"\ | |
667 | + "fcmov" CC " %2, %0\n"\ | |
668 | + : "=t" (res)\ | |
669 | + : "0" (a), "u" (b), "g" (eflags));\ | |
670 | + printf("fcmov%s eflags=0x%04x-> %f\n", \ | |
671 | + CC, eflags, res);\ | |
672 | +} | |
673 | + | |
674 | +void test_fcmov(void) | |
675 | +{ | |
676 | + double a, b; | |
677 | + int eflags, i; | |
678 | + | |
679 | + a = 1.0; | |
680 | + b = 2.0; | |
681 | + for(i = 0; i < 4; i++) { | |
682 | + eflags = 0; | |
683 | + if (i & 1) | |
684 | + eflags |= CC_C; | |
685 | + if (i & 2) | |
686 | + eflags |= CC_Z; | |
687 | + TEST_FCMOV(a, b, eflags, "b"); | |
688 | + TEST_FCMOV(a, b, eflags, "e"); | |
689 | + TEST_FCMOV(a, b, eflags, "be"); | |
690 | + TEST_FCMOV(a, b, eflags, "nb"); | |
691 | + TEST_FCMOV(a, b, eflags, "ne"); | |
692 | + TEST_FCMOV(a, b, eflags, "nbe"); | |
693 | + } | |
694 | + TEST_FCMOV(a, b, 0, "u"); | |
695 | + TEST_FCMOV(a, b, CC_P, "nu"); | |
696 | +} | |
697 | + | |
661 | 698 | void test_floats(void) |
662 | 699 | { |
663 | 700 | test_fops(2, 3); |
... | ... | @@ -675,6 +712,9 @@ void test_floats(void) |
675 | 712 | test_fbcd(1234567890123456); |
676 | 713 | test_fbcd(-123451234567890); |
677 | 714 | test_fenv(); |
715 | + if (TEST_CMOV) { | |
716 | + test_fcmov(); | |
717 | + } | |
678 | 718 | } |
679 | 719 | |
680 | 720 | /**********************************************/ | ... | ... |