]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Test m{t,f}{xer,lr,ctr} in a simpler way.
authorJulian Seward <jseward@acm.org>
Sat, 19 Nov 2005 20:39:16 +0000 (20:39 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 19 Nov 2005 20:39:16 +0000 (20:39 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5211

none/tests/ppc32/jm-insns.c

index a2750b77a88fa3415eea8da9bbc9760a3e95ceef..99b8880fcf6bd3c25d0b4683a00a29c4ebe966ad 100644 (file)
@@ -4578,6 +4578,44 @@ static void mfspr_cb (const char* name, test_func_t func,
    // Call func, just to stop compiler complaining
    (*func)();
  
+   // mtxer followed by mfxer
+   for (k=0; k<nb_iargs; k++) {
+      j = iargs[k];
+      __asm__ __volatile__(
+         "mtxer %1\n"
+         "\tmfxer %0"
+         : /*out*/"=r"(res) : /*in*/"r"(j) : /*trashed*/"xer" 
+      );
+      res &= 0xE000007F; /* rest of the bits are undefined */
+      printf("%s: %08x -> mtxer -> mfxer => %08x\n",
+             name, j, res);
+   }
+
+   // mtlr followed by mflr
+   for (k=0; k<nb_iargs; k++) {
+      j = iargs[k];
+      __asm__ __volatile__(
+         "mtlr %1\n"
+         "\tmflr %0"
+         : /*out*/"=r"(res) : /*in*/"r"(j) : /*trashed*/"lr" 
+      );
+      printf("%s: %08x ->  mtlr ->  mflr => %08x\n",
+             name, j, res);
+   }
+
+   // mtctr followed by mfctr
+   for (k=0; k<nb_iargs; k++) {
+      j = iargs[k];
+      __asm__ __volatile__(
+         "mtctr %1\n"
+         "\tmfctr %0"
+         : /*out*/"=r"(res) : /*in*/"r"(j) : /*trashed*/"ctr" 
+      );
+      printf("%s: %08x -> mtctr -> mfctr => %08x\n",
+             name, j, res);
+   }
+
+#if 0
    // mfxer
    j = 1;
    for (k=0; k<nb_iargs; k++) {
@@ -4703,6 +4741,7 @@ static void mfspr_cb (const char* name, test_func_t func,
       printf("%s %d (%08x) => %08x (%08x %08x, %08x, %08x)\n",
              name, 9, iargs[k], res, flags, xer, lr, ctr);
    }
+#endif
 }
 
 #if 0