mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Check lsw/stsw insns in 64-bit mode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5599
This commit is contained in:
parent
9045ab4f72
commit
1e0aac8d52
@ -4,10 +4,11 @@ noinst_SCRIPTS = filter_stderr
|
||||
EXTRA_DIST = $(noinst_SCRIPTS) \
|
||||
jm-int.stderr.exp jm-int.stdout.exp jm-int.vgtest \
|
||||
jm-fp.stderr.exp jm-fp.stdout.exp jm-fp.vgtest \
|
||||
jm-vmx.stderr.exp jm-vmx.stdout.exp jm-vmx.vgtest
|
||||
jm-vmx.stderr.exp jm-vmx.stdout.exp jm-vmx.vgtest \
|
||||
lsw.stderr.exp lsw.stdout.exp lsw.vgtest
|
||||
|
||||
check_PROGRAMS = \
|
||||
jm-insns
|
||||
jm-insns lsw
|
||||
|
||||
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include \
|
||||
@FLAG_M64@
|
||||
|
||||
102
none/tests/ppc64/lsw.c
Normal file
102
none/tests/ppc64/lsw.c
Normal file
@ -0,0 +1,102 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Apparently the "b" register constraint is like "r" except that it
|
||||
disallows the use of r0, which means it is safe to use in places
|
||||
where the appearance of r0 would cause a problem due to it being
|
||||
read as zero. */
|
||||
|
||||
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"
|
||||
: : "b"(a1), "b"(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"
|
||||
: : "b"(a1), "b"(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"
|
||||
: : "b"(a1), "b"(a2), "b"(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"
|
||||
: : "b"(a1), "b"(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"
|
||||
: : "b"(a1), "b"(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"
|
||||
: : "b"(a1), "b"(a2), "b"(16) : "r3", "r4", "r5", "r8",
|
||||
"cc", "memory" );
|
||||
printf("%s\n", a2+16);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
2
none/tests/ppc64/lsw.stderr.exp
Normal file
2
none/tests/ppc64/lsw.stderr.exp
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
|
||||
54
none/tests/ppc64/lsw.stdout.exp
Normal file
54
none/tests/ppc64/lsw.stdout.exp
Normal file
@ -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
|
||||
|
||||
1
none/tests/ppc64/lsw.vgtest
Normal file
1
none/tests/ppc64/lsw.vgtest
Normal file
@ -0,0 +1 @@
|
||||
prog: lsw
|
||||
Loading…
x
Reference in New Issue
Block a user