|
From: <sv...@va...> - 2012-12-21 18:35:01
|
florian 2012-12-21 18:34:48 +0000 (Fri, 21 Dec 2012)
New Revision: 13195
Log:
Companion patch to VEX r2605. Adds a few testcases and adapts the vbit
tester. This is part of fixing BZ #307113.
Patch by Maran Pakkirisamy (ma...@li...).
Added files:
trunk/none/tests/s390x/dfp-2.c
trunk/none/tests/s390x/dfp-2.stderr.exp
trunk/none/tests/s390x/dfp-2.stdout.exp
trunk/none/tests/s390x/dfp-2.vgtest
trunk/none/tests/s390x/dfp_utils.h
Modified directories:
trunk/none/tests/s390x/
Modified files:
trunk/memcheck/tests/vbit-test/irops.c
trunk/none/tests/s390x/Makefile.am
trunk/none/tests/s390x/dfp-1.c
trunk/none/tests/s390x/dfp-1.stdout.exp
trunk/none/tests/s390x/opcodes.h
Modified: trunk/none/tests/s390x/
Modified: trunk/none/tests/s390x/dfp-1.stdout.exp (+33 -9)
===================================================================
--- trunk/none/tests/s390x/dfp-1.stdout.exp 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-1.stdout.exp 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -1,9 +1,33 @@
-Decimal floating point 64-bit arithmetic
-dfp64_add: 2220ff3fcff3fcff
-dfp64_add: 6e24ff3fcff3fcff
-dfp64_sub: ee20ff3fcff3fcff
-dfp64_sub: ee24ff3fcff3fcff
-dfp64_mul: 6e208c0000000000
-dfp64_mul: 6e248c0000000000
-dfp64_div: 6a206ec7ff7fab55
-dfp64_div: 2a3dec7b1ec7b1ed
+Decimal floating point arithmetic
+64-bit ADD
+2230000000000194 + 222c000000000005 = 222c000000000cc5 cc = 2
+a230000000000194 + 222c000000000005 = a22c000000000cb5 cc = 1
+2230000000000194 + a230000000000194 = 2230000000000000 cc = 0
+64-bit SUBTRACT
+2230000000000194 - 222c000000000005 = 222c000000000cb5 cc = 2
+a230000000000194 - 222c000000000005 = a22c000000000cc5 cc = 1
+2230000000000194 - 2230000000000194 = 2230000000000000 cc = 0
+64-bit MULTIPLY
+2230000000000194 * 2238000000000007 = 22300000000008de cc = 0
+a230000000000194 * 2238000000000007 = a2300000000008de cc = 0
+a230000000000194 * 2238000000000000 = a230000000000000 cc = 0
+64-bit DIVIDE
+2238000000000022 / 2238000000000007 = 2dfcc2d74c2d74c3 cc = 0
+a238000000000022 / 2238000000000007 = adfcc2d74c2d74c3 cc = 0
+2238000000000000 / 2238000000000007 = 2238000000000000 cc = 0
+128-bit ADD
+220780000000000000000194 + 220740000000000000000005 = 220740000000000000000cc5 cc = 2
+a20780000000000000000194 + 220740000000000000000005 = a20740000000000000000cb5 cc = 1
+220780000000000000000194 + a20780000000000000000194 = 220780000000000000000000 cc = 0
+128-bit SUBTRACT
+220780000000000000000194 - 220740000000000000000005 = 220740000000000000000cb5 cc = 2
+a20780000000000000000194 - 220740000000000000000005 = a20740000000000000000cc5 cc = 1
+220780000000000000000194 - 220780000000000000000194 = 220780000000000000000000 cc = 0
+128-bit MULTIPLY
+220780000000000000000194 * 220800000000000000000007 = 2207800000000000000008de cc = 0
+a20780000000000000000194 * 220800000000000000000007 = a207800000000000000008de cc = 0
+220780000000000000000194 * 220800000000000000000000 = 220780000000000000000000 cc = 0
+128-bit DIVIDE
+220800000000000000000022 / 220800000000000000000007 = 2dffcc2d74c2d74c2d74c2d74c2d74c3 cc = 0
+a20800000000000000000022 / 220800000000000000000007 = adffcc2d74c2d74c2d74c2d74c2d74c3 cc = 0
+220800000000000000000000 / 220800000000000000000007 = 220800000000000000000000 cc = 0
Modified: trunk/memcheck/tests/vbit-test/irops.c (+19 -19)
===================================================================
--- trunk/memcheck/tests/vbit-test/irops.c 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/memcheck/tests/vbit-test/irops.c 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -477,30 +477,30 @@
{ DEFOP(Iop_Recip32x2, UNDEF_UNKNOWN), },
{ DEFOP(Iop_Rsqrte32x2, UNDEF_UNKNOWN), },
/* ------------------ Decimal Floating Point ------------------ */
- { DEFOP(Iop_AddD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_SubD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_MulD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_DivD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_AddD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_SubD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_MulD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_DivD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_AddD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_SubD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_MulD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_DivD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_AddD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_SubD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_MulD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_DivD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_ShlD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_ShrD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_ShlD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_ShrD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D32toD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D64toD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D32toD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D64toD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_I64StoD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D64toD32, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D128toD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D64toD32, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D128toD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_I64StoD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_D64toI64S, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_D128toI64S, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_RoundD64toInt, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_RoundD128toInt, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_CmpD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_CmpD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_CmpD64, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_CmpD128, UNDEF_ALL), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_QuantizeD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_QuantizeD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_SignificanceRoundD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
@@ -509,13 +509,13 @@
{ DEFOP(Iop_ExtractExpD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_InsertExpD64, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_InsertExpD128, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D64HLtoD128, UNDEF_CONCAT), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D128HItoD64, UNDEF_UPPER), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_D128LOtoD64, UNDEF_TRUNC), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D64HLtoD128, UNDEF_CONCAT), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D128HItoD64, UNDEF_UPPER), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_D128LOtoD64, UNDEF_TRUNC), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_DPBtoBCD, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
{ DEFOP(Iop_BCDtoDPB, UNDEF_ALL), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_ReinterpI64asD64, UNDEF_SAME), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
- { DEFOP(Iop_ReinterpD64asI64, UNDEF_SAME), .s390x = 0, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_ReinterpI64asD64, UNDEF_SAME), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
+ { DEFOP(Iop_ReinterpD64asI64, UNDEF_SAME), .s390x = 1, .ppc64 = 1, .ppc32 = 1 },
/* ------------------ 128-bit SIMD FP. ------------------ */
{ DEFOP(Iop_Add32Fx4, UNDEF_UNKNOWN), },
{ DEFOP(Iop_Sub32Fx4, UNDEF_UNKNOWN), },
Added: trunk/none/tests/s390x/dfp-2.c (+79 -0)
===================================================================
--- trunk/none/tests/s390x/dfp-2.c 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-2.c 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include "dfp_utils.h"
+
+/* Test various DFP ops:
+ - extract significance 64/128 bit
+ - load and test 64/128 bit
+*/
+
+#if 0 //fixs390: enable it when Iop_ExtractSigD64/D128 is available
+void esdtr(_Decimal64 in)
+{
+ long out;
+ asm volatile(".insn rre, 0xb3e70000, %[out], %[in]\n\t"
+ :[out] "=d" (out) :[in] "f" (in));
+ printf("ESDTR ");
+ DFP_VAL_PRINT(in, _Decimal64);
+ printf(" -> %ld\n", out);
+}
+
+void esxtr(_Decimal128 in)
+{
+ long out;
+ asm volatile(".insn rre, 0xb3ef0000, %[out], %[in]\n\t"
+ :[out] "=d" (out) :[in] "f" (in));
+ printf("ESXTR ");
+ DFP_VAL_PRINT(in, _Decimal128);
+ printf(" -> %ld\n", out);
+}
+#endif
+
+void ltdtr(_Decimal64 in)
+{
+ _Decimal64 out;
+ int cc;
+ asm volatile(".insn rre, 0xb3d60000, %[out], %[in]\n\t"
+ "ipm %1\n\t"
+ "srl %1,28\n\t"
+ :[out] "=d" (out), "=d" (cc)
+ :[in] "f" (in));
+ printf("LTDTR ");
+ DFP_VAL_PRINT(in, _Decimal64);
+ printf(" -> %d\n", cc);
+}
+
+void ltxtr(_Decimal128 in)
+{
+ _Decimal128 out;
+ int cc;
+ asm volatile(".insn rre, 0xb3de0000, %[out], %[in]\n\t"
+ "ipm %1\n\t"
+ "srl %1,28\n\t"
+ :[out] "=f" (out), "=d" (cc)
+ :[in] "f" (in));
+ printf("LTXTR ");
+ DFP_VAL_PRINT(in, _Decimal128);
+ printf(" -> %d\n", cc);
+}
+
+int main() {
+ _Decimal64 d64 = 50.0005DD;
+ _Decimal128 d128 = 50.0005DL;
+
+#if 0 //fixs390: enable it when Iop_ExtractSigD64/D128 is available
+ esdtr(d64);
+ esdtr(-d64);
+ esdtr(0.DD);
+ esxtr(d128);
+ esxtr(-d128);
+ esxtr(0.DL);
+#endif
+ ltdtr(d64);
+ ltdtr(-d64);
+ ltdtr(0.0DD);
+ ltxtr(d128);
+ ltxtr(-d128);
+ ltxtr(0.0DL);
+
+ return 0;
+}
Modified: trunk/none/tests/s390x/dfp-1.c (+156 -57)
===================================================================
--- trunk/none/tests/s390x/dfp-1.c 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-1.c 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -1,74 +1,173 @@
#include <stdio.h>
#include "opcodes.h"
+#include "dfp_utils.h"
-volatile _Decimal64 d64_1, d64_2;
+volatile _Decimal64 d64_1, d64_2, result_64;
+volatile _Decimal128 d128_1, d128_2, result_128;
-#define DFP64_BINOP(insn, op1, op2, type, round, cc) \
-({ \
- register type f1 asm("f1") = op1; \
- register type f2 asm("f2") = op2; \
- /* f1 = f1 (op) f2 */ \
- asm volatile(insn(2,round,1,1) \
- "ipm %1\n\t" \
- "srl %1,28\n\t" \
- :"+f" (f1), "=d" (cc) \
- :"f"(f2) \
- ); \
- f1; \
-})
+#define DFP_BINOP(insn, op1, op2, type, round, cc) \
+ ({ \
+ register type d1 asm("f0") = op1; \
+ register type d2 asm("f1") = op2; \
+ /* d1 = d1 (op) d2 */ \
+ asm volatile(insn(1,round,0,0) \
+ "ipm %1\n\t" \
+ "srl %1,28\n\t" \
+ :"+f" (d1), "=d" (cc) \
+ :"f"(d2) \
+ ); \
+ d1; \
+ })
int main() {
- _Decimal64 result;
int cc;
- printf("Decimal floating point 64-bit arithmetic\n");
- // fixs390: print result in DFP format once required insns are supported.
+ printf("Decimal floating point arithmetic\n");
/* 64-bit ADD */
- /* case 1: result has maximum significand digits */
- d64_1 = 999999999.0DD;
- d64_2 = 0.999999DD;
- result = DFP64_BINOP(ADTRA, d64_1, d64_2, _Decimal64, 1, cc);
- printf("dfp64_add: %lx\n", *((unsigned long *) &result));
- /* case 2: result is rounded */
- d64_1 = 99999999999.0DD;
- d64_2 = 0.999999DD;
- result = DFP64_BINOP(ADTRA, d64_1, d64_2, _Decimal64, 3, cc);
- printf("dfp64_add: %lx\n", *((unsigned long *) &result));
+ printf("64-bit ADD\n");
+ /* case 1: cc = 2 */
+ d64_1 = 3.14DD;
+ d64_2 = 0.005DD;
+ result_64 = DFP_BINOP(ADTRA, d64_1, d64_2, _Decimal64, 1, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "+", cc);
+ /* case 2: cc = 1 */
+ d64_1 = -3.14DD;
+ d64_2 = 0.005DD;
+ result_64 = DFP_BINOP(ADTRA, d64_1, d64_2, _Decimal64, 1, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "+", cc);
+ /* case 2: cc = 0 */
+ d64_1 = 3.14DD;
+ d64_2 = -d64_1;
+ result_64 = DFP_BINOP(ADTRA, d64_1, d64_2, _Decimal64, 3, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "+", cc);
+
/* 64-bit SUBTRACT */
- /* case 1: result has maximum significand digits */
- d64_1 = 0.000001DD;
- d64_2 = 10000000000.0DD;
- result = DFP64_BINOP(SDTRA, d64_1, d64_2, _Decimal64, 4, cc);
- printf("dfp64_sub: %lx\n", *((unsigned long *) &result));
- /* case 2: result is rounded */
- d64_1 = 0.000001DD;
- d64_2 = 100000000000.0DD;
- result = DFP64_BINOP(SDTRA, d64_1, d64_2, _Decimal64, 5, cc);
- printf("dfp64_sub: %lx\n", *((unsigned long *) &result));
+ printf("64-bit SUBTRACT\n");
+ /* case 1: cc = 2 */
+ d64_1 = 3.14DD;
+ d64_2 = 0.005DD;
+ result_64 = DFP_BINOP(SDTRA, d64_1, d64_2, _Decimal64, 4, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "-", cc);
+ /* case 2: cc = 1 */
+ d64_1 = -3.14DD;
+ d64_2 = 0.005DD;
+ result_64 = DFP_BINOP(SDTRA, d64_1, d64_2, _Decimal64, 5, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "-", cc);
+ /* case 3: cc = 0 */
+ d64_1 = 3.14DD;
+ d64_2 = d64_1;
+ result_64 = DFP_BINOP(SDTRA, d64_1, d64_2, _Decimal64, 5, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "-", cc);
/* 64-bit MULTIPLY */
- /* case 1: result has maximum significand digits */
- d64_1 = 9999999999.999999DD;
- d64_2 = .99DD;
- result = DFP64_BINOP(MDTRA, d64_1, d64_2, _Decimal64, 6, cc);
- printf("dfp64_mul: %lx\n", *((unsigned long *) &result));
- /* case 2: result is rounded */
- d64_1 = 99999999999.999999DD;
- d64_2 = .99DD;
- result = DFP64_BINOP(MDTRA, d64_1, d64_2, _Decimal64, 7, cc);
- printf("dfp64_mul: %lx\n", *((unsigned long *) &result));
+ printf("64-bit MULTIPLY\n");
+ /* case 1: cc = 2 */
+ d64_1 = 3.14DD;
+ d64_2 = 7.DD;
+ result_64 = DFP_BINOP(MDTRA, d64_1, d64_2, _Decimal64, 6, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "*", cc);
+ /* case 2: cc = 1 */
+ d64_1 = -3.14DD;
+ d64_2 = 7.DD;
+ result_64 = DFP_BINOP(MDTRA, d64_1, d64_2, _Decimal64, 7, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "*", cc);
+ /* case 3: cc = 0 */
+ d64_1 = -3.14DD;
+ d64_2 = 0.DD;
+ result_64 = DFP_BINOP(MDTRA, d64_1, d64_2, _Decimal64, 7, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "*", cc);
/* 64-bit DIVIDE */
- /* case 1: result has maximum significand digits */
- d64_1 = 8888888888.888877DD;
- d64_2 = 0.999999DD;
- result = DFP64_BINOP(DDTRA, d64_1, d64_2, _Decimal64, d, cc);
- printf("dfp64_div: %lx\n", *((unsigned long *) &result));
- /* case 2: result is rounded */
- d64_1 = 88888888888.888877DD;
- d64_2 = 0.000003DD;
- result = DFP64_BINOP(DDTRA, d64_1, d64_2, _Decimal64, e, cc);
- printf("dfp64_div: %lx\n", *((unsigned long *) &result));
+ printf("64-bit DIVIDE\n");
+ /* case 1: cc = 2 */
+ d64_1 = 22.DD;
+ d64_2 = 7.DD;
+ result_64 = DFP_BINOP(DDTRA, d64_1, d64_2, _Decimal64, d, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "/", cc);
+ /* case 2: cc = 1 */
+ d64_1 = -22.DD;
+ d64_2 = 7.DD;
+ result_64 = DFP_BINOP(DDTRA, d64_1, d64_2, _Decimal64, e, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "/", cc);
+ /* case 3: cc = 0 */
+ d64_1 = 0.DD;
+ d64_2 = 7.DD;
+ result_64 = DFP_BINOP(DDTRA, d64_1, d64_2, _Decimal64, e, cc);
+ DFP_BINOP_PRINT(d64_1, d64_2, result_64, _Decimal64, "/", cc);
+
+ /* 128-bit ADD */
+ printf("128-bit ADD\n");
+ /* case 1: cc = 2 */
+ d128_1 = 3.14DL;
+ d128_2 = 0.005DL;
+ result_128 = DFP_BINOP(AXTRA, d128_1, d128_2, _Decimal128, 1, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "+", cc);
+ /* case 2: cc = 1 */
+ d128_1 = -3.14DL;
+ d128_2 = 0.005DL;
+ result_128 = DFP_BINOP(AXTRA, d128_1, d128_2, _Decimal128, 1, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "+", cc);
+ /* case 3: cc = 0 */
+ d128_1 = 3.14DL;
+ d128_2 = -d128_1;
+ result_128 = DFP_BINOP(AXTRA, d128_1, d128_2, _Decimal128, 3, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "+", cc);
+
+ /* 128-bit SUBTRACT */
+ printf("128-bit SUBTRACT\n");
+ /* case 1: cc = 2 */
+ d128_1 = 3.14DL;
+ d128_2 = 0.005DL;
+ result_128 = DFP_BINOP(SXTRA, d128_1, d128_2, _Decimal128, 4, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "-", cc);
+ /* case 2: cc = 1 */
+ d128_1 = -3.14DL;
+ d128_2 = 0.005DL;
+ result_128 = DFP_BINOP(SXTRA, d128_1, d128_2, _Decimal128, 5, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "-", cc);
+ /* case 3: cc = 0 */
+ d128_1 = 3.14DL;
+ d128_2 = d128_1;
+ result_128 = DFP_BINOP(SXTRA, d128_1, d128_2, _Decimal128, 5, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "-", cc);
+
+ /* 128-bit MULTIPLY */
+ printf("128-bit MULTIPLY\n");
+ /* case 1: cc = 2 */
+ d128_1 = 3.14DL;
+ d128_2 = 7.DL;
+ result_128 = DFP_BINOP(MXTRA, d128_1, d128_2, _Decimal128, 6, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "*", cc);
+ /* case 2: cc = 1 */
+ d128_1 = -3.14DL;
+ d128_2 = 7.DL;
+ result_128 = DFP_BINOP(MXTRA, d128_1, d128_2, _Decimal128, 7, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "*", cc);
+ /* case 3: cc = 0 */
+ d128_1 = 3.14DL;
+ d128_2 = 0.DL;
+ result_128 = DFP_BINOP(MXTRA, d128_1, d128_2, _Decimal128, 7, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "*", cc);
+
+ /* 128-bit DIVIDE */
+ printf("128-bit DIVIDE\n");
+ /* case 1: cc = 2 */
+ d128_1 = 22.DL;
+ d128_2 = 7.DL;
+ result_128 = DFP_BINOP(DXTRA, d128_1, d128_2, _Decimal128, d, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "/", cc);
+ /* case 2: cc = 1 */
+ d128_1 = -22.DL;
+ d128_2 = 7.DL;
+ result_128 = DFP_BINOP(DXTRA, d128_1, d128_2, _Decimal128, e, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "/", cc);
+ /* case 3: cc = 0 */
+ d128_1 = 0.DL;
+ d128_2 = 7.DL;
+ result_128 = DFP_BINOP(DXTRA, d128_1, d128_2, _Decimal128, e, cc);
+ DFP_BINOP_PRINT(d128_1, d128_2, result_128, _Decimal128, "/", cc);
+
+ return 0;
}
Modified: trunk/none/tests/s390x/opcodes.h (+8 -0)
===================================================================
--- trunk/none/tests/s390x/opcodes.h 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/opcodes.h 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -127,15 +127,19 @@
#define ALY(r1,x2,b2,dl2,dh2) RXY_RRRD(e3,r1,x2,b2,dl2,dh2,5e)
#define ARK(r3,r1,r2) RRF_R0RR2(b9f8,r3,0,r1,r2)
#define ASI(i2,b1,dl1,dh1) SIY_IRD(eb,i2,b1,dl1,dh1,6a)
+#define AXTRA(r3,m4,r1,r2) RRF_FUFF2(b3da,r3,m4,r1,r2)
#define AY(r1,x2,b2,dl2,dh2) RXY_RRRD(e3,r1,x2,b2,dl2,dh2,5a)
#define CDFBRA(m3,m4,r1,r2) RRF_UUFR(b395,m3,m4,r1,r2)
#define CDGBRA(m3,m4,r1,r2) RRF_UUFR(b3a5,m3,m4,r1,r2)
#define CDLFBR(m3,m4,r1,r2) RRF_UUFR(b391,m3,m4,r1,r2)
#define CDLGBR(m3,m4,r1,r2) RRF_UUFR(b3a1,m3,m4,r1,r2)
+#define CDTR(r1,r2) RRE_RERE(b3e4,r1,r2)
+#define CEDTR(r1,r2) RRE_RERE(b3f4,r1,r2)
#define CEFBRA(m3,m4,r1,r2) RRF_UUFR(b394,m3,m4,r1,r2)
#define CEGBRA(m3,m4,r1,r2) RRF_UUFR(b3a4,m3,m4,r1,r2)
#define CELFBR(m3,m4,r1,r2) RRF_UUFR(b390,m3,m4,r1,r2)
#define CELGBR(m3,m4,r1,r2) RRF_UUFR(b3a0,m3,m4,r1,r2)
+#define CEXTR(r1,r2) RRE_RERE(b3fc,r1,r2)
#define CFEBRA(m3,m4,r1,r2) RRF_UURF(b398,m3,m4,r1,r2)
#define CFDBRA(m3,m4,r1,r2) RRF_UURF(b399,m3,m4,r1,r2)
#define CFI(r1,i2) RIL_RI(c2,r1,d,i2)
@@ -211,8 +215,10 @@
#define CXGBRA(m3,m4,r1,r2) RRF_UUFR(b3a6,m3,m4,r1,r2)
#define CXLFBR(m3,m4,r1,r2) RRF_UUFR(b392,m3,m4,r1,r2)
#define CXLGBR(m3,m4,r1,r2) RRF_UUFR(b3a2,m3,m4,r1,r2)
+#define CXTR(r1,r2) RRE_RERE(b3ec,r1,r2)
#define CY(r1,x2,b2,dl2,dh2) RXY_RRRD(e3,r1,x2,b2,dl2,dh2,59)
#define DDTRA(r3,m4,r1,r2) RRF_FUFF2(b3d1,r3,m4,r1,r2)
+#define DXTRA(r3,m4,r1,r2) RRF_FUFF2(b3d9,r3,m4,r1,r2)
#define EXRL(r1,i2) RIL_RP(c6,r1,0,i2)
#define FLOGR(r1,r2) RRE_RR(b983,00,r1,r2)
#define ICMY(r1,r3,b2,dl2,dh2) RSY_RURD(eb,r1,r3,b2,dl2,dh2,81)
@@ -287,6 +293,7 @@
#define MVHHI(b1,d1,i2) SIL_RDI(e544,b1,d1,i2)
#define MVHI(b1,d1,i2) SIL_RDI(e54c,b1,d1,i2)
#define MVIY(i2,b1,dl1,dh1) SIY_URD(eb,i2,b1,dl1,dh1,52)
+#define MXTRA(r3,m4,r1,r2) RRF_FUFF2(b3d8,r3,m4,r1,r2)
#define NGRK(r3,r1,r2) RRF_R0RR2(b9e4,r3,0,r1,r2)
#define NIHF(r1,i2) RIL_RU(c0,r1,a,i2)
#define NILF(r1,i2) RIL_RU(c0,r1,b,i2)
@@ -341,6 +348,7 @@
#define STOCG(r1,r3,b2,dl2,dh2) RSY_RDRM(eb,r1,r3,b2,dl2,dh2,e3)
#define STRL(r1,i2) RIL_RP(c4,r1,f,i2)
#define STY(r1,x2,b2,dl2,dh2) RXY_RRRD(e3,r1,x2,b2,dl2,dh2,50)
+#define SXTRA(r3,m4,r1,r2) RRF_FUFF2(b3db,r3,m4,r1,r2)
#define SY(r1,x2,b2,dl2,dh2) RXY_RRRD(e3,r1,x2,b2,dl2,dh2,5b)
#define TMY(i2,b1,dl1,dh1) SIY_URD(eb,i2,b1,dl1,dh1,51)
#define XGRK(r3,r1,r2) RRF_R0RR2(b9e7,r3,0,r1,r2)
Added: trunk/none/tests/s390x/dfp-2.vgtest (+2 -0)
===================================================================
--- trunk/none/tests/s390x/dfp-2.vgtest 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-2.vgtest 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -0,0 +1,2 @@
+prog: dfp-2
+prereq: test -e dfp-2 && ../../../tests/s390x_features s390x-dfp
Modified: trunk/none/tests/s390x/Makefile.am (+3 -2)
===================================================================
--- trunk/none/tests/s390x/Makefile.am 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/Makefile.am 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -19,7 +19,7 @@
spechelper-icm-1 spechelper-icm-2 spechelper-tmll \
spechelper-tm laa
if BUILD_DFP_TESTS
- INSN_TESTS += dfp-1
+ INSN_TESTS += dfp-1 dfp-2
endif
check_PROGRAMS = $(INSN_TESTS) \
@@ -35,7 +35,8 @@
fpext_fail.vgtest fpext_fail.stderr.exp fpext_fail.stdout.exp \
test.h opcodes.h add.h and.h div.h insert.h \
mul.h or.h sub.h xor.h table.h svc.h rounding.h \
- dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest
+ dfp-1.stderr.exp dfp-1.stdout.exp dfp-1.vgtest \
+ dfp-2.stderr.exp dfp-2.stdout.exp dfp-2.vgtest
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
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
+ .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
Added: trunk/none/tests/s390x/dfp_utils.h (+27 -0)
===================================================================
--- trunk/none/tests/s390x/dfp_utils.h 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp_utils.h 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -0,0 +1,27 @@
+#ifndef DFP_UTILS_H
+#define DFP_UTILS_H
+
+/* convinience macros to print DFP values to avoid linking libdfp to
+ DFP testcases */
+
+#define DFP_VAL_PRINT(op, type) \
+ { \
+ size_t n = sizeof(type); \
+ if (n == 8) \
+ printf("%lx", *((unsigned long *) &op)); \
+ else \
+ printf("%lx%08lx", *((unsigned long *) &op), \
+ *(((unsigned long *) &op) + 1)); \
+ }
+
+#define DFP_BINOP_PRINT(op1, op2, result, type, op, cc) \
+ { \
+ DFP_VAL_PRINT(op1, type); \
+ printf(" "op" "); \
+ DFP_VAL_PRINT(op2, type); \
+ printf(" = "); \
+ DFP_VAL_PRINT(result, type); \
+ printf(" cc = %d\n", cc); \
+ }
+
+#endif /* DFP_UTILS_H */
Added: trunk/none/tests/s390x/dfp-2.stdout.exp (+6 -0)
===================================================================
--- trunk/none/tests/s390x/dfp-2.stdout.exp 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-2.stdout.exp 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -0,0 +1,6 @@
+LTDTR 22280000000a0005 -> 2
+LTDTR a2280000000a0005 -> 1
+LTDTR 2234000000000000 -> 0
+LTXTR 2207000000000000000a0005 -> 2
+LTXTR a207000000000000000a0005 -> 1
+LTXTR 2207c0000000000000000000 -> 0
Added: trunk/none/tests/s390x/dfp-2.stderr.exp (+2 -0)
===================================================================
--- trunk/none/tests/s390x/dfp-2.stderr.exp 2012-12-21 10:34:08 +00:00 (rev 13194)
+++ trunk/none/tests/s390x/dfp-2.stderr.exp 2012-12-21 18:34:48 +00:00 (rev 13195)
@@ -0,0 +1,2 @@
+
+
|