From: Florian Krohm Date: Thu, 13 Sep 2012 03:04:23 +0000 (+0000) Subject: s390: Add testcase for square root and load positive/negative/complement. X-Git-Tag: svn/VALGRIND_3_9_0~691 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=479b63d85334b3e3374922e6683fdec83763b4e0;p=thirdparty%2Fvalgrind.git s390: Add testcase for square root and load positive/negative/complement. Tests are for 32/64-bit values only. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12967 --- diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am index f03c58cf30..2304e489bb 100644 --- a/none/tests/s390x/Makefile.am +++ b/none/tests/s390x/Makefile.am @@ -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 index 0000000000..5dae5ff4fd --- /dev/null +++ b/none/tests/s390x/bfp-2.c @@ -0,0 +1,102 @@ +#include + +/* 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 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/s390x/bfp-2.stderr.exp @@ -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 index 0000000000..074180a279 --- /dev/null +++ b/none/tests/s390x/bfp-2.stdout.exp @@ -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 index 0000000000..239b8f985d --- /dev/null +++ b/none/tests/s390x/bfp-2.vgtest @@ -0,0 +1 @@ +prog: bfp-2