]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390: Add testcase for square root and load positive/negative/complement.
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 13 Sep 2012 03:04:23 +0000 (03:04 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 13 Sep 2012 03:04:23 +0000 (03:04 +0000)
Tests are for 32/64-bit values only.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12967

none/tests/s390x/Makefile.am
none/tests/s390x/bfp-2.c [new file with mode: 0644]
none/tests/s390x/bfp-2.stderr.exp [new file with mode: 0644]
none/tests/s390x/bfp-2.stdout.exp [new file with mode: 0644]
none/tests/s390x/bfp-2.vgtest [new file with mode: 0644]

index f03c58cf302bc4159fb548c58b60bfb0a50c7778..2304e489bbec2036c553aa61a284abd0b9605f35 100644 (file)
@@ -9,7 +9,8 @@ INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
              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
+            rounding-1 rounding-2 rounding-3 rounding-4 rounding-5 bfp-1 \
+             bfp-2
 
 check_PROGRAMS = $(INSN_TESTS) \
                 allexec \
diff --git a/none/tests/s390x/bfp-2.c b/none/tests/s390x/bfp-2.c
new file mode 100644 (file)
index 0000000..5dae5ff
--- /dev/null
@@ -0,0 +1,102 @@
+#include <stdio.h>
+
+/* Test various BFP ops:
+   - square root
+   - load negative
+   - load positive
+   - load complement
+*/
+
+void sqebr(float in)
+{
+   float out;
+
+   __asm__ volatile("sqebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("sqebr  %f  -> %f\n", in, out);
+}
+
+void sqdbr(double in)
+{
+   double out;
+
+   __asm__ volatile("sqdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("sqdbr  %f  -> %f\n", in, out);
+}
+
+void lnebr(float in)
+{
+   float out;
+
+   __asm__ volatile("lnebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lnebr  %f  -> %f\n", in, out);
+}
+
+void lndbr(double in)
+{
+   double out;
+
+   __asm__ volatile("lndbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lndbr  %f  -> %f\n", in, out);
+}
+
+void lpebr(float in)
+{
+   float out;
+
+   __asm__ volatile("lpebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lpebr  %f  -> %f\n", in, out);
+}
+
+void lpdbr(double in)
+{
+   double out;
+
+   __asm__ volatile("lpdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lpdbr  %f  -> %f\n", in, out);
+}
+
+void lcebr(float in)
+{
+   float out;
+
+   __asm__ volatile("lcebr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lcebr  %f  -> %f\n", in, out);
+}
+
+void lcdbr(double in)
+{
+   double out;
+
+   __asm__ volatile("lcdbr %[out],%[in]" : [out]"=f"(out) : [in]"f"(in));
+   printf("lcdbr  %f  -> %f\n", in, out);
+}
+
+int main(void)
+{
+   // square root
+   sqebr(121.0f);  // 4 byte values
+   sqdbr(144.0);   // 8 bytes values
+
+   // load negative
+   lnebr(-2.5f);   // 4 byte values
+   lnebr(12.5f);   // 4 byte values
+
+   lndbr(-0.5);    // 8 byte values
+   lndbr(42.5);    // 8 byte values
+
+   // load positive
+   lpebr(-2.5f);   // 4 byte values
+   lpebr(12.5f);   // 4 byte values
+
+   lpdbr(-0.5);    // 8 byte values
+   lpdbr(42.5);    // 8 byte values
+
+   // load complement
+   lcebr(-23.5f);  // 4 byte values
+   lcebr(123.5f);  // 4 byte values
+
+   lcdbr(-17.5);   // 8 byte values
+   lcdbr(234.5);   // 8 byte values
+
+   return 0;
+}
diff --git a/none/tests/s390x/bfp-2.stderr.exp b/none/tests/s390x/bfp-2.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/s390x/bfp-2.stdout.exp b/none/tests/s390x/bfp-2.stdout.exp
new file mode 100644 (file)
index 0000000..074180a
--- /dev/null
@@ -0,0 +1,14 @@
+sqebr  121.000000  -> 11.000000
+sqdbr  144.000000  -> 12.000000
+lnebr  -2.500000  -> -2.500000
+lnebr  12.500000  -> -12.500000
+lndbr  -0.500000  -> -0.500000
+lndbr  42.500000  -> -42.500000
+lpebr  -2.500000  -> 2.500000
+lpebr  12.500000  -> 12.500000
+lpdbr  -0.500000  -> 0.500000
+lpdbr  42.500000  -> 42.500000
+lcebr  -23.500000  -> 23.500000
+lcebr  123.500000  -> -123.500000
+lcdbr  -17.500000  -> 17.500000
+lcdbr  234.500000  -> -234.500000
diff --git a/none/tests/s390x/bfp-2.vgtest b/none/tests/s390x/bfp-2.vgtest
new file mode 100644 (file)
index 0000000..239b8f9
--- /dev/null
@@ -0,0 +1 @@
+prog: bfp-2