s390: Add testcase for bfp multiply-and-add/sub


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12968 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
index 2304e48..d0c5f98 100644
--- a/none/tests/s390x/Makefile.am
+++ b/none/tests/s390x/Makefile.am
@@ -9,8 +9,8 @@
              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 \
-	     rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \
-             bfp-2
+             rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \
+             bfp-2 bfp-3
 
 check_PROGRAMS = $(INSN_TESTS) \
 		 allexec \
diff --git a/none/tests/s390x/bfp-3.c b/none/tests/s390x/bfp-3.c
new file mode 100644
index 0000000..857e1c8
--- /dev/null
+++ b/none/tests/s390x/bfp-3.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+
+/* Test BFP multiply and add/sub  32/64-bit. There are no such insns
+   working with 128-bit data */
+
+void maebr(float v1, float v2, float v3)
+{
+   float r1 = v1;
+
+   __asm__ volatile("maebr %[r1],%[r3],%[r2]"
+                    : [r1]"+f"(r1) : [r2]"f"(v2), [r3]"f"(v3));
+   printf("maebr  %f * %f + %f  -> %f\n", v2, v3, v1, r1);
+}
+
+void madbr(double v1, double v2, double v3)
+{
+   double r1 = v1;
+
+   __asm__ volatile("madbr %[r1],%[r3],%[r2]"
+                    : [r1]"+f"(r1) : [r2]"f"(v2), [r3]"f"(v3));
+   printf("madbr  %f * %f + %f  -> %f\n", v2, v3, v1, r1);
+}
+
+void msebr(float v1, float v2, float v3)
+{
+   float r1 = v1;
+
+   __asm__ volatile("msebr %[r1],%[r3],%[r2]"
+                    : [r1]"+f"(r1) : [r2]"f"(v2), [r3]"f"(v3));
+   printf("msebr  %f * %f - %f  -> %f\n", v2, v3, v1, r1);
+}
+
+void msdbr(double v1, double v2, double v3)
+{
+   double r1 = v1;
+
+   __asm__ volatile("msdbr %[r1],%[r3],%[r2]"
+                    : [r1]"+f"(r1) : [r2]"f"(v2), [r3]"f"(v3));
+   printf("msdbr  %f * %f - %f  -> %f\n", v2, v3, v1, r1);
+}
+
+int main(void)
+{
+   // multiply and add
+   maebr(10.5f, 20.25, 3.0);  // 4 byte values
+   madbr(-10.5, 42.75, -2.0); // 8 byte values
+
+   // multiply and sub
+   msebr(10.5f, 20.25, 3.0);  // 4 byte values
+   msdbr(-10.5, 42.75, -2.0); // 8 byte values
+
+   return 0;
+}
diff --git a/none/tests/s390x/bfp-3.stderr.exp b/none/tests/s390x/bfp-3.stderr.exp
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/none/tests/s390x/bfp-3.stderr.exp
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/bfp-3.stdout.exp b/none/tests/s390x/bfp-3.stdout.exp
new file mode 100644
index 0000000..bd9e5c4
--- /dev/null
+++ b/none/tests/s390x/bfp-3.stdout.exp
@@ -0,0 +1,4 @@
+maebr  20.250000 * 3.000000 + 10.500000  -> 71.250000
+madbr  42.750000 * -2.000000 + -10.500000  -> -96.000000
+msebr  20.250000 * 3.000000 - 10.500000  -> 50.250000
+msdbr  42.750000 * -2.000000 - -10.500000  -> -75.000000
diff --git a/none/tests/s390x/bfp-3.vgtest b/none/tests/s390x/bfp-3.vgtest
new file mode 100644
index 0000000..8088d7d
--- /dev/null
+++ b/none/tests/s390x/bfp-3.vgtest
@@ -0,0 +1 @@
+prog: bfp-3