To test extended BFP opcodes we need sizeof(long double) == 16.
Certain old versions of GCC don't have that as default. So we must
give -mlong-double-128 on the command line.
Pertains to BZ #352183.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15623 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.ac b/configure.ac
index 9211b95..95bc904 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1847,6 +1847,25 @@
 AC_SUBST(PREFERRED_STACK_BOUNDARY_2)
 
 
+# does this compiler support -mlong-double-128 ?
+AC_MSG_CHECKING([if gcc accepts -mlong-double-128])
+safe_CFLAGS=$CFLAGS
+CFLAGS="-mlong-double-128 -Werror"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+  return 0;
+]])], [
+ac_compiler_supports_mlong_double_128=yes
+AC_MSG_RESULT([yes])
+], [
+ac_compiler_supports_mlong_double_128=no
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+AM_CONDITIONAL(HAS_MLONG_DOUBLE_128, test x$ac_compiler_supports_mlong_double_128 = xyes)
+FLAG_MLONG_DOUBLE_128="-mlong-double-128"
+AC_SUBST(FLAG_MLONG_DOUBLE_128)
+
+
 # Convenience function to check whether GCC supports a particular
 # warning option. Takes two arguments,
 # first the warning flag name to check (without -W), then the
diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
index 4100088..f4fede1 100644
--- a/none/tests/s390x/Makefile.am
+++ b/none/tests/s390x/Makefile.am
@@ -8,7 +8,7 @@
              op_exception fgx stck stckf stcke stfle cksm mvcl clcl troo \
              trto trot trtt tr tre cij cgij clij clgij crj cgrj clrj clgrj \
              cs csg cds cdsg cu21 cu21_1 cu24 cu24_1 cu42 cu12 cu12_1 \
-             ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext fpext_warn \
+             ex_sig ex_clone cu14 cu14_1 cu41 fpconv ecag fpext_warn \
              rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \
              bfp-2 bfp-3 bfp-4 srnm srnmb comp-1 comp-2 exrl tmll tm stmg \
 	     ex clst mvc test_fork test_sig rounding-6 rxsbg\
@@ -21,6 +21,9 @@
 if BUILD_DFP_TESTS
   INSN_TESTS += dfp-1 dfp-2 dfp-3 dfp-4 dfptest dfpext dfpconv srnmt pfpo
 endif
+if HAS_MLONG_DOUBLE_128
+  INSN_TESTS += fpext
+endif
 
 check_PROGRAMS = $(INSN_TESTS) \
 		 allexec \
@@ -33,6 +36,7 @@
 	ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \
 	ecag.stdout.exp-z13 \
 	op00.stderr.exp1 op00.stderr.exp2 op00.vgtest \
+	fpext.vgtest fpext.stderr.exp fpext.stdout.exp \
 	fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \
 	test.h opcodes.h add.h  and.h  div.h  insert.h dfp_utils.h \
 	mul.h  or.h  sub.h  xor.h table.h svc.h rounding.h \
@@ -56,5 +60,5 @@
 cu14_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
 cu21_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
 cu24_1_CFLAGS    = $(AM_CFLAGS) -DM3=1
-
+fpext_CFLAGS     = $(AM_CFLAGS) @FLAG_MLONG_DOUBLE_128@
 ex_clone_LDFLAGS = -lpthread
diff --git a/none/tests/s390x/fpext.vgtest b/none/tests/s390x/fpext.vgtest
index 4740430..948bad9 100644
--- a/none/tests/s390x/fpext.vgtest
+++ b/none/tests/s390x/fpext.vgtest
@@ -1,2 +1,2 @@
 prog: fpext
-prereq: ../../../tests/s390x_features s390x-fpext
+prereq: test -e fpext && ../../../tests/s390x_features s390x-fpext
diff --git a/none/tests/s390x/fpext_fail.vgtest b/none/tests/s390x/fpext_fail.vgtest
index 64ed5ee..970cbed 100644
--- a/none/tests/s390x/fpext_fail.vgtest
+++ b/none/tests/s390x/fpext_fail.vgtest
@@ -1,2 +1,2 @@
 prog: fpext
-prereq: ../../../tests/s390x_features '!s390x-fpext'
+prereq: test -e fpext && ../../../tests/s390x_features '!s390x-fpext'