aboutsummaryrefslogtreecommitdiff
path: root/tests/test-i386.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-11-16 20:18:52 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-11-16 20:18:52 +0000
commit75175024757fd716dc0f8d50d9a8837b6d88143d (patch)
tree8c8fd6386963cff7f5349e65113b48baee7a2855 /tests/test-i386.c
parent8f2b1fb008a3bd8964f381c91adf7a7abeccd577 (diff)
fcmovx support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@464 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/test-i386.c')
-rw-r--r--tests/test-i386.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test-i386.c b/tests/test-i386.c
index 09c6626330..2bcc574dbb 100644
--- a/tests/test-i386.c
+++ b/tests/test-i386.c
@@ -658,6 +658,43 @@ void test_fenv(void)
TEST_ENV(&float_env32, "");
}
+
+#define TEST_FCMOV(a, b, eflags, CC)\
+{\
+ double res;\
+ asm("push %3\n"\
+ "popf\n"\
+ "fcmov" CC " %2, %0\n"\
+ : "=t" (res)\
+ : "0" (a), "u" (b), "g" (eflags));\
+ printf("fcmov%s eflags=0x%04x-> %f\n", \
+ CC, eflags, res);\
+}
+
+void test_fcmov(void)
+{
+ double a, b;
+ int eflags, i;
+
+ a = 1.0;
+ b = 2.0;
+ for(i = 0; i < 4; i++) {
+ eflags = 0;
+ if (i & 1)
+ eflags |= CC_C;
+ if (i & 2)
+ eflags |= CC_Z;
+ TEST_FCMOV(a, b, eflags, "b");
+ TEST_FCMOV(a, b, eflags, "e");
+ TEST_FCMOV(a, b, eflags, "be");
+ TEST_FCMOV(a, b, eflags, "nb");
+ TEST_FCMOV(a, b, eflags, "ne");
+ TEST_FCMOV(a, b, eflags, "nbe");
+ }
+ TEST_FCMOV(a, b, 0, "u");
+ TEST_FCMOV(a, b, CC_P, "nu");
+}
+
void test_floats(void)
{
test_fops(2, 3);
@@ -675,6 +712,9 @@ void test_floats(void)
test_fbcd(1234567890123456);
test_fbcd(-123451234567890);
test_fenv();
+ if (TEST_CMOV) {
+ test_fcmov();
+ }
}
/**********************************************/