|
From: <sv...@va...> - 2012-12-28 15:54:31
|
florian 2012-12-28 15:54:23 +0000 (Fri, 28 Dec 2012)
New Revision: 13214
Log:
s390: Add testcase for "test data class/group" insns.
Patch by Maran Pakkirisamy (ma...@li...).
This is part of fixing BZ 307113.
Added files:
trunk/none/tests/s390x/dfptest.c
trunk/none/tests/s390x/dfptest.stderr.exp
trunk/none/tests/s390x/dfptest.stdout.exp
trunk/none/tests/s390x/dfptest.vgtest
Modified directories:
trunk/none/tests/s390x/
Modified files:
trunk/none/tests/s390x/Makefile.am
Modified: trunk/none/tests/s390x/
Added: trunk/none/tests/s390x/dfptest.c (+125 -0)
===================================================================
--- trunk/none/tests/s390x/dfptest.c 2012-12-28 09:12:14 +00:00 (rev 13213)
+++ trunk/none/tests/s390x/dfptest.c 2012-12-28 15:54:23 +00:00 (rev 13214)
@@ -0,0 +1,125 @@
+#include <math.h>
+#include <stdio.h>
+
+/* Following macros adopted from dfp/math.h from libdfp */
+#define DEC_INFINITY __builtin_infd64()
+#define DEC_NAN (0.0DF * DEC_INFINITY)
+
+/* Following instructions are tested:
+test data class tests for
+ _Decimal32 - TDCET
+ _Decimal64 - TDCDT
+ _decimal128 - TDCXT
+test data group tests for
+ _Decimal32 - TDGET
+ _Decimal64 - TDGDT
+ _decimal128 - TDGXT
+*/
+
+#define TEST_128(opcode, d, n) \
+ ({ \
+ int match; \
+ _Decimal128 f = d; \
+ long long num = n; \
+ asm volatile(opcode ", %1,0(%2)\n" \
+ "ipm %0\n" \
+ "srl %0,28\n" \
+ : "=d" (match) : "f" (f), "a" (num) : "cc"); \
+ match; \
+ })
+
+#define TEST_64(opcode, d, n) \
+ ({ \
+ int match; \
+ _Decimal64 f = d; \
+ long long num = n; \
+ asm volatile(opcode ", %1,0(%2)\n" \
+ "ipm %0\n" \
+ "srl %0,28\n" \
+ : "=d" (match) : "f" (f), "a" (num) : "cc"); \
+ match; \
+ })
+
+#define TEST_32(opcode, d, n) \
+ ({ \
+ int match; \
+ _Decimal32 f = d; \
+ long long num = n; \
+ asm volatile(opcode ", %1,0(%2)\n" \
+ "ipm %0\n" \
+ "srl %0,28\n" \
+ : "=d" (match) : "f" (f), "a" (num) : "cc"); \
+ match; \
+ })
+
+int main()
+{
+ int i;
+
+ /* The right most 12 bits 52:63 of the second operand are set and tested */
+ for (i = 0; i < 12; i++) {
+ /* DFP 128 bit - TDCXT */
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", +0.0DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", -0.0DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", +2.2DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", -2.2DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000058", -DEC_NAN, 1UL<<i));
+
+ /* DFP 128 bit - TDGXT */
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", +0.0DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", -0.0DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", +2.2DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", -2.2DF, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_128(".insn rxe, 0xed0000000059", -DEC_NAN, 1UL<<i));
+
+ /* DFP 64 bit - TDCDT */
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", +0.0DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", -0.0DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", +2.2DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", -2.2DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000054", -DEC_NAN, 1UL<<i));
+
+ /* DFP 64 bit - TDGDT */
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", +0.0DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", -0.0DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", +2.2DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", -2.2DF, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_64(".insn rxe, 0xed0000000055", -DEC_NAN, 1UL<<i));
+
+ /* DFP 32 bit - TDCET */
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", +0.0DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", -0.0DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", +2.2DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", -2.2DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000050", -DEC_NAN, 1UL<<i));
+
+ /* DFP 32 bit - TDGET */
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", +0.0DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", -0.0DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", +2.2DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", -2.2DF, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051",+DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051",-DEC_INFINITY,1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", +DEC_NAN, 1UL<<i));
+ printf("%d", TEST_32(".insn rxe, 0xed0000000051", -DEC_NAN, 1UL<<i));
+
+ printf("\n");
+
+ }
+ return 0;
+}
Added: trunk/none/tests/s390x/dfptest.vgtest (+2 -0)
===================================================================
--- trunk/none/tests/s390x/dfptest.vgtest 2012-12-28 09:12:14 +00:00 (rev 13213)
+++ trunk/none/tests/s390x/dfptest.vgtest 2012-12-28 15:54:23 +00:00 (rev 13214)
@@ -0,0 +1,2 @@
+prog: dfptest
+prereq: test -e dfptest && ../../../tests/s390x_features s390x-dfp
Added: trunk/none/tests/s390x/dfptest.stderr.exp (+2 -0)
===================================================================
--- trunk/none/tests/s390x/dfptest.stderr.exp 2012-12-28 09:12:14 +00:00 (rev 13213)
+++ trunk/none/tests/s390x/dfptest.stderr.exp 2012-12-28 15:54:23 +00:00 (rev 13214)
@@ -0,0 +1,2 @@
+
+
Property changed: trunk/none/tests/s390x (+0 -0)
___________________________________________________________________
Name: svn:ignore
- .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
cu21
cu21_1
cu24
cu24_1
cu42
cu12
cu12_1
cu14
cu14_1
cu41
ecag
fpext
fpext_warn
fpconv
rounding-1
rounding-2
rounding-3
rounding-4
rounding-5
bfp-1
bfp-2
bfp-3
bfp-4
srnm
srnmb
comp-1
comp-2
ex
exrl
tm
tmll
stmg
test_sig
test_clone
test_fork
clst
mvc
spechelper-algr
spechelper-tmll
spechelper-icm-1
spechelper-icm-2
spechelper-cr
spechelper-ltr
spechelper-alr
spechelper-clr
spechelper-slr
spechelper-slgr
spechelper-or
spechelper-tm
rounding-6
laa
dfp-1
dfp-2
dfp-3
dfp-4
+ .deps
add
add_EI
add_GE
allexec
and
and_EI
clc
clcle
cvb
cvd
div
ex_clone
ex_sig
flogr
icm
insert
insert_EI
lam_stam
lpr
Makefile
Makefile.in
mul
mul_GE
mvst
or
or_EI
srst
sub
sub_EI
tcxb
xc
xor
xor_EI
stck
stcke
stckf
op_exception
fgx
condloadstore
fold_And16
stfle
op00
cksm
clcl
mvcl
troo
trot
trto
trtt
tr
tre
clrj
clgrj
crj
cgrj
clij
clgij
cij
cgij
cs
csg
cds
cdsg
cu21
cu21_1
cu24
cu24_1
cu42
cu12
cu12_1
cu14
cu14_1
cu41
ecag
fpext
fpext_warn
fpconv
rounding-1
rounding-2
rounding-3
rounding-4
rounding-5
bfp-1
bfp-2
bfp-3
bfp-4
srnm
srnmb
comp-1
comp-2
ex
exrl
tm
tmll
stmg
test_sig
test_clone
test_fork
clst
mvc
spechelper-algr
spechelper-tmll
spechelper-icm-1
spechelper-icm-2
spechelper-cr
spechelper-ltr
spechelper-alr
spechelper-clr
spechelper-slr
spechelper-slgr
spechelper-or
spechelper-tm
rounding-6
laa
dfp-1
dfp-2
dfp-3
dfp-4
dfptest
Added: trunk/none/tests/s390x/dfptest.stdout.exp (+12 -0)
===================================================================
--- trunk/none/tests/s390x/dfptest.stdout.exp 2012-12-28 09:12:14 +00:00 (rev 13213)
+++ trunk/none/tests/s390x/dfptest.stdout.exp 2012-12-28 15:54:23 +00:00 (rev 13214)
@@ -0,0 +1,12 @@
+000000000000010100000000000001010000000000000101
+000000000000101000000000000010100000000000001010
+000000010000000000000001000000000000000100000000
+000000100000000000000010000000000000001000000000
+000001000001000000000100000100000000010000010000
+000010000010000000001000001000000000100000100000
+000100000000000000010000000000000001000000000000
+001000000000000000100000000000000010000000000000
+000000000000000000000000000000000000000000000000
+000000000000000000000000000000000000000000000000
+010000000100000001000000010000000100000001000000
+100000001000000010000000100000001000000010000000
Modified: trunk/none/tests/s390x/Makefile.am (+3 -2)
===================================================================
--- trunk/none/tests/s390x/Makefile.am 2012-12-28 09:12:14 +00:00 (rev 13213)
+++ trunk/none/tests/s390x/Makefile.am 2012-12-28 15:54:23 +00:00 (rev 13214)
@@ -19,7 +19,7 @@
spechelper-icm-1 spechelper-icm-2 spechelper-tmll \
spechelper-tm laa
if BUILD_DFP_TESTS
- INSN_TESTS += dfp-1 dfp-2 dfp-3 dfp-4
+ INSN_TESTS += dfp-1 dfp-2 dfp-3 dfp-4 dfptest
endif
check_PROGRAMS = $(INSN_TESTS) \
@@ -38,7 +38,8 @@
dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \
dfp-2.stderr.exp dfp-2.stdout.exp dfp-2.vgtest \
dfp-3.stderr.exp dfp-3.stdout.exp dfp-3.vgtest \
- dfp-4.stderr.exp dfp-4.stdout.exp dfp-4.vgtest
+ dfp-4.stderr.exp dfp-4.stdout.exp dfp-4.vgtest \
+ dfptest.stderr.exp dfptest.stdout.exp dfptest.vgtest
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
|