aboutsummaryrefslogtreecommitdiff
path: root/tests/test-i386.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-18 21:57:29 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-18 21:57:29 +0000
commitd575b78aabd7579959cc089cc993960709b5bb33 (patch)
tree1aa9aec299dfbb6263a8179f68b6e79f515ebbdf /tests/test-i386.c
parent6e44ba7fa22389896be6c21b68b53778a0775821 (diff)
more xadd tests - cmpxchg8b test
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@558 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests/test-i386.c')
-rw-r--r--tests/test-i386.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test-i386.c b/tests/test-i386.c
index 0718f5a0e5..086ff28871 100644
--- a/tests/test-i386.c
+++ b/tests/test-i386.c
@@ -832,6 +832,13 @@ void test_xchg(void)
TEST_XCHG(xaddw, "w", "=q");
TEST_XCHG(xaddb, "b", "=q");
+ {
+ int res;
+ res = 0x12345678;
+ asm("xaddl %1, %0" : "=r" (res) : "0" (res));
+ printf("xaddl same res=%08x\n", res);
+ }
+
TEST_XCHG(xaddl, "", "=m");
TEST_XCHG(xaddw, "w", "=m");
TEST_XCHG(xaddb, "b", "=m");
@@ -851,6 +858,27 @@ void test_xchg(void)
TEST_CMPXCHG(cmpxchgl, "", "=m", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgw, "w", "=m", 0xfffefdfc);
TEST_CMPXCHG(cmpxchgb, "b", "=m", 0xfffefdfc);
+
+ {
+ uint64_t op0, op1, op2;
+ int i, eflags;
+
+ for(i = 0; i < 2; i++) {
+ op0 = 0x123456789abcd;
+ if (i == 0)
+ op1 = 0xfbca765423456;
+ else
+ op1 = op0;
+ op2 = 0x6532432432434;
+ asm("cmpxchg8b %1\n"
+ "pushf\n"
+ "popl %2\n"
+ : "=A" (op0), "=m" (op1), "=g" (eflags)
+ : "0" (op0), "m" (op1), "b" ((int)op2), "c" ((int)(op2 >> 32)));
+ printf("cmpxchg8b: op0=%016llx op1=%016llx CC=%02x\n",
+ op0, op1, eflags & CC_Z);
+ }
+ }
}
/**********************************************/