summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-16 20:28:50 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-03-16 20:28:50 +0000
commit1a9353d258aba69afd8a389bf5fb705caab12ce0 (patch)
tree6d82000351db013b87af23a2f554bdd5a5bf6b5a /tests
parent6dbad63eef5947c6c8750e44f408138779b6d0bb (diff)
downloadqemu-1a9353d258aba69afd8a389bf5fb705caab12ce0.tar.gz
added loop/xadd/cmpxchg support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@29 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests')
-rw-r--r--tests/test-i386.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-i386.c b/tests/test-i386.c
index 95ec5d1509..4d68ae2126 100644
--- a/tests/test-i386.c
+++ b/tests/test-i386.c
@@ -689,6 +689,37 @@ void test_segs(void)
printf("SS[tmp] = %02x\n", res2);
}
+#define TEST_XCHG(op, size, opconst)\
+{\
+ int op0, op1;\
+ op0 = 0x12345678;\
+ op1 = 0xfbca7654;\
+ asm(#op " %" size "0, %" size "1" \
+ : "=q" (op0), opconst (op1) \
+ : "0" (op0), "1" (op1));\
+ printf("%-10s A=%08x B=%08x\n",\
+ #op, op0, op1);\
+}
+
+void test_xchg(void)
+{
+ TEST_XCHG(xchgl, "", "=q");
+ TEST_XCHG(xchgw, "w", "=q");
+ TEST_XCHG(xchgb, "b", "=q");
+
+ TEST_XCHG(xchgl, "", "=m");
+ TEST_XCHG(xchgw, "w", "=m");
+ TEST_XCHG(xchgb, "b", "=m");
+
+ TEST_XCHG(xaddl, "", "=q");
+ TEST_XCHG(xaddw, "w", "=q");
+ TEST_XCHG(xaddb, "b", "=q");
+
+ TEST_XCHG(xaddl, "", "=m");
+ TEST_XCHG(xaddw, "w", "=m");
+ TEST_XCHG(xaddb, "b", "=m");
+}
+
static void *call_end __init_call = NULL;
int main(int argc, char **argv)
@@ -706,6 +737,7 @@ int main(int argc, char **argv)
test_jcc();
test_floats();
test_bcd();
+ test_xchg();
test_lea();
test_segs();
return 0;