Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / none / tests / s390x / dfptest.c
blobc49fa39b3d4f8ec86b262c6abcd86a39568d7e9e
1 #include "dfp_utils.h"
2 #include <stdio.h>
4 /* Following instructions are tested:
5 test data class tests for
6 _Decimal32 - TDCET
7 _Decimal64 - TDCDT
8 _decimal128 - TDCXT
9 test data group tests for
10 _Decimal32 - TDGET
11 _Decimal64 - TDGDT
12 _decimal128 - TDGXT
15 static const pun_d32 d32_vals[] = {
16 {0x22400000}, /* +0.0DF */
17 {0xa2400000}, /* -0.0DF */
18 {0x22400022}, /* +2.2DF */
19 {0xa2400022}, /* -2.2DF */
20 {0x78000000}, /* DEC_INFINITY */
21 {0xf8000000}, /* -DEC_INFINITY */
22 {0x7c000000}, /* +DEC_NAN */
23 {0xfc000000}, /* -DEC_NAN */
26 static const pun_d64 d64_vals[] = {
27 {0x2234000000000000}, {0xa234000000000000}, {0x2234000000000022},
28 {0xa234000000000022}, {0x7800000000000000}, {0xf800000000000000},
29 {0x7c00000000000000}, {0xfc00000000000000},
32 static const pun_d128 d128_vals[] = {
33 {{0x2207c00000000000, 0x0000000000000000}},
34 {{0xa207c00000000000, 0x0000000000000000}},
35 {{0x2207c00000000000, 0x0000000000000022}},
36 {{0xa207c00000000000, 0x0000000000000022}},
37 {{0x7800000000000000, 0x0000000000000000}},
38 {{0xf800000000000000, 0x0000000000000000}},
39 {{0x7c00000000000000, 0x0000000000000000}},
40 {{0xfc00000000000000, 0x0000000000000000}},
43 #define TEST(opcode, ty, n) \
44 ({ \
45 const long num = n; \
46 for (unsigned j = 0; j != sizeof(ty##_vals) / sizeof(ty##_vals[0]); \
47 j++) { \
48 int cc; \
49 asm(".insn rxe, " opcode ", %[dec],0(%[bits])\n\t" \
50 "ipm %[cc]\n" \
51 "srl %[cc],28" \
52 : [cc] "=d"(cc) \
53 : [dec] "f"(ty##_vals[j].f), [bits] "a"(num) \
54 : "cc"); \
55 printf("%d", cc); \
56 } \
59 int main()
61 int i;
63 /* The rightmost 12 bits 52:63 of the second operand are set and tested */
64 for (i = 0; i < 12; i++) {
65 TEST("0xed0000000058", d128, 1UL << i); /* TDCXT */
66 TEST("0xed0000000059", d128, 1UL << i); /* TDGXT */
67 TEST("0xed0000000054", d64, 1UL << i); /* TDCDT */
68 TEST("0xed0000000055", d64, 1UL << i); /* TDGDT */
69 TEST("0xed0000000050", d32, 1UL << i); /* TDCET */
70 TEST("0xed0000000051", d32, 1UL << i); /* TDGET */
71 printf("\n");
73 return 0;