]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
* Enable cmpxchg tests.
authorJulian Seward <jseward@acm.org>
Thu, 26 Aug 2004 11:27:21 +0000 (11:27 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 26 Aug 2004 11:27:21 +0000 (11:27 +0000)
* Enable long-running arithmetic test.
* Run the shift/rotate test with all input flag combinations.
  This shows up some incorrect flag results for rotates by
  exact multiples of the word size.

git-svn-id: svn://svn.valgrind.org/vex/trunk@217

VEX/test/test-i386-shift.h
VEX/test/test-i386.c
VEX/test/test-i386.h

index c3d8793b8b6636fb28011d58e6fd839b7dc0776c..e86b85f5a787367c6fff955f4b9d2e19842921ac 100644 (file)
@@ -107,21 +107,39 @@ void exec_opb(int s0, int s1, int iflags)
 
 void exec_op(int s2, int s0, int s1)
 {
-    exec_opl(s2, s0, s1, 0);
+  int o,s,z,a,c,p,flags_in;
+  for (o = 0; o < 2; o++) {
+  for (s = 0; s < 2; s++) {
+  for (z = 0; z < 2; z++) {
+  for (a = 0; a < 2; a++) {
+  for (c = 0; c < 2; c++) {
+  for (p = 0; p < 2; p++) {
+
+    flags_in = (o ? CC_O : 0)
+             | (s ? CC_S : 0)
+             | (z ? CC_Z : 0)
+             | (a ? CC_A : 0)
+             | (c ? CC_C : 0)
+             | (p ? CC_P : 0);
+    exec_opl(s2, s0, s1, flags_in);
 #ifdef OP_SHIFTD
     if (s1 <= 15)
-        exec_opw(s2, s0, s1, 0);
+        exec_opw(s2, s0, s1, flags_in);
 #else
-    exec_opw(s2, s0, s1, 0);
+    exec_opw(s2, s0, s1, flags_in);
 #endif
 #ifndef OP_NOBYTE
-    exec_opb(s0, s1, 0);
+    exec_opb(s0, s1, flags_in);
 #endif
 #ifdef OP_CC
-    exec_opl(s2, s0, s1, CC_C);
-    exec_opw(s2, s0, s1, CC_C);
-    exec_opb(s0, s1, CC_C);
+    exec_opl(s2, s0, s1, flags_in);
+    exec_opw(s2, s0, s1, flags_in);
+    exec_opb(s0, s1, flags_in);
 #endif
+
+  }}}}}}
+
 }
 
 void glue(test_, OP)(void)
index 2bc386a7df5271b4ea19075b16725a7485cbb50b..97141fc91e171d27835ea1ad3b1b6d39492adf01 100644 (file)
@@ -824,6 +824,7 @@ void test_bcd(void)
     TEST_BCD(aam, 0x12340547, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A));
     TEST_BCD(aad, 0x12340407, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A));
 }
+#endif /* 0 */
 
 #define TEST_XCHG(op, size, opconst)\
 {\
@@ -859,6 +860,7 @@ void test_xchg(void)
     TEST_XCHG(xchgw, "w", "=m");
     TEST_XCHG(xchgb, "b", "=m");
 
+#if 0
     TEST_XCHG(xaddl, "", "=q");
     TEST_XCHG(xaddw, "w", "=q");
     TEST_XCHG(xaddb, "b", "=q");
@@ -873,7 +875,7 @@ void test_xchg(void)
     TEST_XCHG(xaddl, "", "=m");
     TEST_XCHG(xaddw, "w", "=m");
     TEST_XCHG(xaddb, "b", "=m");
-
+#endif
     TEST_CMPXCHG(cmpxchgl, "", "=q", 0xfbca7654);
     TEST_CMPXCHG(cmpxchgw, "w", "=q", 0xfbca7654);
     TEST_CMPXCHG(cmpxchgb, "b", "=q", 0xfbca7654);
@@ -889,7 +891,7 @@ void test_xchg(void)
     TEST_CMPXCHG(cmpxchgl, "", "=m", 0xfffefdfc);
     TEST_CMPXCHG(cmpxchgw, "w", "=m", 0xfffefdfc);
     TEST_CMPXCHG(cmpxchgb, "b", "=m", 0xfffefdfc);
-
+#if 0
     {
         uint64_t op0, op1, op2;
         int i, eflags;
@@ -910,8 +912,8 @@ void test_xchg(void)
                     op0, op1, eflags & CC_Z);
         }
     }
-}
 #endif
+}
 
 /**********************************************/
 /* segmentation tests */
@@ -1649,7 +1651,7 @@ int main(int argc, char **argv)
     test_jcc(); //-------------
     //    test_floats();
     //test_bcd();
-    //test_xchg();
+    test_xchg();
     //    test_string();  // REINSTATE
     // test_misc();  // REINSTATE
     test_lea();  //------------------
index 3c21600437cb667785575779a19ab2350a97e42e..2e5973709546bf3d89a4602b8a90bfd93792813b 100644 (file)
@@ -163,7 +163,7 @@ void glue(test_, OP)(void)
     exec_op(0x12348080, 1);
     exec_op(0x12348080, -2);
 
-    if (0)
+    if (1)
     for (i = 0; i < NVALS; i++)
       for (j = 0; j < NVALS; j++)
        exec_op(val[i], val[j]);