From d575b78aabd7579959cc089cc993960709b5bb33 Mon Sep 17 00:00:00 2001 From: bellard Date: Sun, 18 Jan 2004 21:57:29 +0000 Subject: [PATCH] more xadd tests - cmpxchg8b test git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@558 c046a42c-6fe2-441c-8c8c-71466251a162 --- tests/test-i386.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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); + } + } } /**********************************************/ -- 2.11.0