]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add test case for STRT. See #319395.
authorJulian Seward <jseward@acm.org>
Mon, 13 May 2013 10:29:32 +0000 (10:29 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 13 May 2013 10:29:32 +0000 (10:29 +0000)
(Vasily Golubev, w.golubev@mail.ru)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13397

none/tests/arm/ldrt.c
none/tests/arm/ldrt.stdout.exp

index 650a497e69a83223019d3477785cd9b38c9e8367..93fdcdc431aea20efe8435a0db99483792ae0842 100644 (file)
@@ -1,6 +1,7 @@
 
 // This should be compiled as Thumb code, since currently V only
-// handles the T1 encoding of ldrt.
+// handles the T1 encoding of ldrt.  This all assumes that we are
+// in a little-endian world.
 
 #include <stdio.h>
 #include <malloc.h>
@@ -17,6 +18,14 @@ __attribute__((noinline)) UInt do_ldrt_imm_132 ( unsigned char* p )
   return res;
 }
 
+__attribute__((noinline)) void do_strt_imm_132 ( unsigned char* p, UInt val )
+{
+  __asm__ __volatile__(
+     "mov r5, %0 ; mov r6, %1 ; strt r6, [r5, #132]"
+      : : "r"(p), "r"(val) : "r5", "r6", "memory"
+  );
+}
+
 int main ( void )
 {
   UInt i;
@@ -25,5 +34,14 @@ int main ( void )
   UInt r = do_ldrt_imm_132(b);
   free(b);
   printf("result is 0x%08x (should be 0x%08x)\n", r, 0x87868584);
+
+  UInt val = (200 << 0) | (150 << 8) | (100 << 16) | (10 << 24);
+  unsigned char* c = malloc(256);
+  for (i = 0; i < 256; i++) c[i] = (unsigned char)i;
+  do_strt_imm_132(c, val);
+  printf("result is %u %u %u %u %u %u (should be %u %u %u %u %u %u)\n",
+         c[131], c[132], c[133], c[134], c[135], c[136],
+         131, 200, 150, 100, 10, 136);
+  free(c);
   return 0;
 }
index 8e409abda952a96711b1e3560aed53d93729a59c..ed9139ef1480d95c0b40917df13a0866bd432edf 100644 (file)
@@ -1 +1,2 @@
 result is 0x87868584 (should be 0x87868584)
+result is 131 200 150 100 10 136 (should be 131 200 150 100 10 136)