Add a test for {l,st}sw{s,i}.  At the moment only works when the program is
compiled -O due to inline assembly problems, and so it fails in a standard
'make regtest'.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4613 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/ppc32/Makefile.am b/none/tests/ppc32/Makefile.am
index e69de29..c03500d 100644
--- a/none/tests/ppc32/Makefile.am
+++ b/none/tests/ppc32/Makefile.am
@@ -0,0 +1,13 @@
+
+noinst_SCRIPTS = filter_cpuid filter_stderr filter_int
+
+CLEANFILES = $(addsuffix .c,$(INSN_TESTS))
+
+EXTRA_DIST = $(noinst_SCRIPTS) \
+	lsw.stderr.exp lsw.stdout.exp lsw.vgtest
+
+check_PROGRAMS = \
+	lsw
+
+AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include
+AM_CXXFLAGS = $(AM_CFLAGS)
diff --git a/none/tests/ppc32/lsw.c b/none/tests/ppc32/lsw.c
new file mode 100644
index 0000000..1d09221
--- /dev/null
+++ b/none/tests/ppc32/lsw.c
@@ -0,0 +1,97 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static void announce ( char* str )
+{
+   printf("------ %s ------\n", str);
+}
+
+int main ( void )
+{
+  int i;
+  char* a1 = malloc(100);
+  char* a2 = malloc(100);
+  strcpy(a1,"here is a stringHERE IS A STRING");
+
+  announce("lswi n == 8 (fe special cased)");
+  asm volatile("li 5,0\n\t"
+               "lswi 3,%0, 8\n\t" 
+               "stw 3,0(%1)\n\t"
+               "stw 4,4(%1)\n\t"
+               "stw 5,8(%1)\n\t"
+               : : "r"(a1), "r"(a2) : "r3", "r4", "r5", 
+                                      "cc", "memory" );
+  printf("%s\n", a2);
+  for (i = 0; i < 12; i++)
+    printf("%d = 0x%2x\n", i, a2[i]);
+  printf("\n");
+
+
+  announce("lswi n /= 8");
+  asm volatile("lswi 3,%0, 9\n\t" 
+               "stw 3,0(%1)\n\t"
+               "stw 4,4(%1)\n\t"
+               "stw 5,8(%1)\n\t"
+               : : "r"(a1), "r"(a2) : "r3", "r4", "r5", 
+                                      "cc", "memory" );
+  printf("%s\n", a2);
+  for (i = 0; i < 12; i++)
+    printf("%d = 0x%2x\n", i, a2[i]);
+  printf("\n");
+
+
+  announce("lswx");
+  free(a2);
+  a2 = malloc(100);
+  asm volatile("li  8, 11\n\t"
+               "mtxer 8\n\t"
+               "lswx 3,%0,%2\n\t" 
+               "stw 3,0(%1)\n\t"
+               "stw 4,4(%1)\n\t"
+               "stw 5,8(%1)\n\t"
+               : : "r"(a1), "r"(a2), "r"(16) : "r3", "r4", "r5", "r8", 
+                                               "cc", "memory" );
+  printf("%s\n", a2);
+  for (i = 0; i < 12; i++)
+     printf("%d = 0x%2x\n", i, a2[i]);
+  printf("\n");
+
+
+  announce("stswi n == 8 (fe special cased)");
+  free(a2);
+  a2 = calloc(100,1);
+  asm volatile("lswi 3,%0, 19\n\t"
+               "stswi 3,%1, 8\n"
+	       : : "r"(a1), "r"(a2) : "r3","r4","r5","r6","r7",
+                                      "cc", "memory" );
+  printf("%s\n", a2);
+  printf("\n");
+
+
+  announce("stswi n /= 8");
+  free(a2);
+  a2 = calloc(100,1);
+  asm volatile("lswi 3,%0, 19\n\t"
+               "stswi 3,%1, 17\n"
+	       : : "r"(a1), "r"(a2) : "r3","r4","r5","r6","r7",
+                                      "cc", "memory" );
+  printf("%s\n", a2);
+  printf("\n");
+
+
+  announce("stswx");
+  free(a2);
+  a2 = calloc(100,1);
+  asm volatile("li  8, 11\n\t"
+               "mtxer 8\n\t"
+               "lswx  3,%0,%2\n\t" 
+               "stswx 3,%1,%2\n\t" 
+               : : "r"(a1), "r"(a2), "r"(16) : "r3", "r4", "r5", "r8", 
+                                               "cc", "memory" );
+  printf("%s\n", a2+16);
+  printf("\n");
+
+  return 0;
+}
diff --git a/none/tests/ppc32/lsw.stderr.exp b/none/tests/ppc32/lsw.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/ppc32/lsw.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/ppc32/lsw.stdout.exp b/none/tests/ppc32/lsw.stdout.exp
new file mode 100644
index 0000000..1ecd857
--- /dev/null
+++ b/none/tests/ppc32/lsw.stdout.exp
@@ -0,0 +1,54 @@
+------ lswi n == 8 (fe special cased) ------
+here is 
+0 = 0x68
+1 = 0x65
+2 = 0x72
+3 = 0x65
+4 = 0x20
+5 = 0x69
+6 = 0x73
+7 = 0x20
+8 = 0x 0
+9 = 0x 0
+10 = 0x 0
+11 = 0x 0
+
+------ lswi n /= 8 ------
+here is a
+0 = 0x68
+1 = 0x65
+2 = 0x72
+3 = 0x65
+4 = 0x20
+5 = 0x69
+6 = 0x73
+7 = 0x20
+8 = 0x61
+9 = 0x 0
+10 = 0x 0
+11 = 0x 0
+
+------ lswx ------
+HERE IS A S
+0 = 0x48
+1 = 0x45
+2 = 0x52
+3 = 0x45
+4 = 0x20
+5 = 0x49
+6 = 0x53
+7 = 0x20
+8 = 0x41
+9 = 0x20
+10 = 0x53
+11 = 0x 0
+
+------ stswi n == 8 (fe special cased) ------
+here is 
+
+------ stswi n /= 8 ------
+here is a stringH
+
+------ stswx ------
+HERE IS A S
+
diff --git a/none/tests/ppc32/lsw.vgtest b/none/tests/ppc32/lsw.vgtest
new file mode 100644
index 0000000..8039094
--- /dev/null
+++ b/none/tests/ppc32/lsw.vgtest
@@ -0,0 +1 @@
+prog: lsw