|
From: <sv...@va...> - 2011-04-27 12:01:02
|
Author: sewardj
Date: 2011-04-27 13:00:51 +0100 (Wed, 27 Apr 2011)
New Revision: 11713
Log:
s390x: fpr - gpr transfer facility -- valgrind side fixes,
and test cases. Fixes #268619.
(Florian Krohm, br...@ac...)
Added:
trunk/none/tests/s390x/fgx.c
trunk/none/tests/s390x/fgx.stderr.exp
trunk/none/tests/s390x/fgx.stdout.exp
trunk/none/tests/s390x/fgx.vgtest
Modified:
trunk/coregrind/m_machine.c
trunk/none/tests/s390x/Makefile.am
Modified: trunk/coregrind/m_machine.c
===================================================================
--- trunk/coregrind/m_machine.c 2011-04-27 11:33:44 UTC (rev 11712)
+++ trunk/coregrind/m_machine.c 2011-04-27 12:00:51 UTC (rev 11713)
@@ -1000,7 +1000,7 @@
vki_sigaction_fromK_t saved_sigill_act;
vki_sigaction_toK_t tmp_sigill_act;
- volatile Bool have_LDISP, have_EIMM, have_GIE, have_DFP;
+ volatile Bool have_LDISP, have_EIMM, have_GIE, have_DFP, have_FGX;
Int r, model;
/* Unblock SIGILL and stash away the old action for that signal */
@@ -1061,6 +1061,13 @@
: : : "r0", "cc", "memory"); /* adtr r0,r0,r0 */
}
+ have_FGX = True;
+ if (VG_MINIMAL_SETJMP(env_unsup_insn)) {
+ have_FGX = False;
+ } else {
+ __asm__ __volatile__(".long 0xb3cd0000" : : : "r0"); /* lgdr r0,f0 */
+ }
+
/* Restore signals */
r = VG_(sigaction)(VKI_SIGILL, &saved_sigill_act, NULL);
vg_assert(r == 0);
@@ -1070,8 +1077,9 @@
model = VG_(get_machine_model)();
- VG_(debugLog)(1, "machine", "machine %d LDISP %d EIMM %d GIE %d DFP %d\n",
- model, have_LDISP, have_EIMM, have_GIE, have_DFP);
+ VG_(debugLog)(1, "machine", "machine %d LDISP %d EIMM %d GIE %d DFP %d "
+ "FGX %d\n", model, have_LDISP, have_EIMM, have_GIE,
+ have_DFP, have_FGX);
if (model == VEX_S390X_MODEL_INVALID) return False;
@@ -1085,6 +1093,7 @@
if (have_EIMM) vai.hwcaps |= VEX_HWCAPS_S390X_EIMM;
if (have_GIE) vai.hwcaps |= VEX_HWCAPS_S390X_GIE;
if (have_DFP) vai.hwcaps |= VEX_HWCAPS_S390X_DFP;
+ if (have_FGX) vai.hwcaps |= VEX_HWCAPS_S390X_FGX;
VG_(debugLog)(1, "machine", "hwcaps = 0x%x\n", vai.hwcaps);
Modified: trunk/none/tests/s390x/Makefile.am
===================================================================
--- trunk/none/tests/s390x/Makefile.am 2011-04-27 11:33:44 UTC (rev 11712)
+++ trunk/none/tests/s390x/Makefile.am 2011-04-27 12:00:51 UTC (rev 11713)
@@ -5,7 +5,7 @@
INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
and or xor insert div srst fold_And16 flogr sub_EI add_EI \
and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
- op_exception
+ op_exception fgx
check_PROGRAMS = $(INSN_TESTS) \
ex_sig \
Added: trunk/none/tests/s390x/fgx.c
===================================================================
--- trunk/none/tests/s390x/fgx.c (rev 0)
+++ trunk/none/tests/s390x/fgx.c 2011-04-27 12:00:51 UTC (rev 11713)
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include "opcodes.h"
+
+int main()
+{
+ register long g asm("r7");
+ register double f asm("f8");
+ double f1;
+
+ memset(&f1, 0x0f, sizeof(double));
+ f = f1;
+ g = 42;
+ printf("test LGDR\n\n");
+ printf("before g = %ld\n", g);
+ printf("before f = %a\n", f);
+ printf("copy f to g\n");
+ asm volatile ( LGDR(7,8) : "=d"(g) : "f"(f));
+ printf("after g = %16.16lx\n", g); /* 0x0x0x0...... */
+ printf("after f = %a\n", f);
+
+ printf("\ntest LDGR\n\n");
+ f = 3.14;
+ printf("before g = %16.16lx\n", g); /* 0x0x0x0...... */
+ printf("before f = %a\n", f);
+ printf("copy g to f\n");
+ asm volatile ( LDGR(8,7) : "=f"(f) : "d"(g));
+ printf("after g = %16.16lx\n", g); /* 0x0x0x0...... */
+ printf("after f = %a\n", f);
+
+ return 0;
+}
+
Added: trunk/none/tests/s390x/fgx.stderr.exp
===================================================================
--- trunk/none/tests/s390x/fgx.stderr.exp (rev 0)
+++ trunk/none/tests/s390x/fgx.stderr.exp 2011-04-27 12:00:51 UTC (rev 11713)
@@ -0,0 +1,2 @@
+
+
Added: trunk/none/tests/s390x/fgx.stdout.exp
===================================================================
--- trunk/none/tests/s390x/fgx.stdout.exp (rev 0)
+++ trunk/none/tests/s390x/fgx.stdout.exp 2011-04-27 12:00:51 UTC (rev 11713)
@@ -0,0 +1,15 @@
+test LGDR
+
+before g = 42
+before f = 0x1.f0f0f0f0f0f0fp-783
+copy f to g
+after g = 0f0f0f0f0f0f0f0f
+after f = 0x1.f0f0f0f0f0f0fp-783
+
+test LDGR
+
+before g = 0f0f0f0f0f0f0f0f
+before f = 0x1.91eb851eb851fp+1
+copy g to f
+after g = 0f0f0f0f0f0f0f0f
+after f = 0x1.f0f0f0f0f0f0fp-783
Added: trunk/none/tests/s390x/fgx.vgtest
===================================================================
--- trunk/none/tests/s390x/fgx.vgtest (rev 0)
+++ trunk/none/tests/s390x/fgx.vgtest 2011-04-27 12:00:51 UTC (rev 11713)
@@ -0,0 +1 @@
+prog: fgx
|