Commit d575b78aabd7579959cc089cc993960709b5bb33
1 parent
6e44ba7f
more xadd tests - cmpxchg8b test
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@558 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
28 additions
and
0 deletions
tests/test-i386.c
... | ... | @@ -832,6 +832,13 @@ void test_xchg(void) |
832 | 832 | TEST_XCHG(xaddw, "w", "=q"); |
833 | 833 | TEST_XCHG(xaddb, "b", "=q"); |
834 | 834 | |
835 | + { | |
836 | + int res; | |
837 | + res = 0x12345678; | |
838 | + asm("xaddl %1, %0" : "=r" (res) : "0" (res)); | |
839 | + printf("xaddl same res=%08x\n", res); | |
840 | + } | |
841 | + | |
835 | 842 | TEST_XCHG(xaddl, "", "=m"); |
836 | 843 | TEST_XCHG(xaddw, "w", "=m"); |
837 | 844 | TEST_XCHG(xaddb, "b", "=m"); |
... | ... | @@ -851,6 +858,27 @@ void test_xchg(void) |
851 | 858 | TEST_CMPXCHG(cmpxchgl, "", "=m", 0xfffefdfc); |
852 | 859 | TEST_CMPXCHG(cmpxchgw, "w", "=m", 0xfffefdfc); |
853 | 860 | TEST_CMPXCHG(cmpxchgb, "b", "=m", 0xfffefdfc); |
861 | + | |
862 | + { | |
863 | + uint64_t op0, op1, op2; | |
864 | + int i, eflags; | |
865 | + | |
866 | + for(i = 0; i < 2; i++) { | |
867 | + op0 = 0x123456789abcd; | |
868 | + if (i == 0) | |
869 | + op1 = 0xfbca765423456; | |
870 | + else | |
871 | + op1 = op0; | |
872 | + op2 = 0x6532432432434; | |
873 | + asm("cmpxchg8b %1\n" | |
874 | + "pushf\n" | |
875 | + "popl %2\n" | |
876 | + : "=A" (op0), "=m" (op1), "=g" (eflags) | |
877 | + : "0" (op0), "m" (op1), "b" ((int)op2), "c" ((int)(op2 >> 32))); | |
878 | + printf("cmpxchg8b: op0=%016llx op1=%016llx CC=%02x\n", | |
879 | + op0, op1, eflags & CC_Z); | |
880 | + } | |
881 | + } | |
854 | 882 | } |
855 | 883 | |
856 | 884 | /**********************************************/ | ... | ... |