4 /* Test DFP value and exponent comparison for 64/128-bit. */
6 #define COMPARE(opc, v1, v2, type) \
9 asm(".insn rre," opc "0000,%[r1],%[r2]\n\t" \
13 : [r1] "f"(v1.f), [r2] "f"(v2.f) \
15 DFP_VAL_PRINT(v1, type); \
30 DFP_VAL_PRINT(v2, type); \
31 printf(" (cc == %d)\n", cc); \
34 /* 64-bit decimal constants */
35 static const pun_d64 dd_inf
= {0x7800000000000000}; /* infinity */
36 static const pun_d64 dd_nan
= {0x7c00000000000000}; /* NaN */
37 static const pun_d64 dd_A
= {0x2220000000500005}; /* 5.000005DD */
38 static const pun_d64 dd_B
= {0x363c000000000000}; /* 5.E16DD + 5.E-6DD */
40 /* 128-bit decimal constants */
41 static const pun_d128 dl_inf
= {{0x7800000000000000, 0x0000000000000000}};
42 static const pun_d128 dl_nan
= {{0x7c00000000000000, 0x0000000000000000}};
43 static const pun_d128 dl_A
= {{0x2206c00000000000, 0x00000000000a0005}};
44 static const pun_d128 dl_B
= {{0x2207c00000000000, 0x0140000000000005}};
48 #define CEDTR "0xb3f4"
49 #define CEXTR "0xb3fc"
53 /* compare 8 bytes DFP value */
55 COMPARE(CDTR
, dd_A
, dd_A
, pun_d64
);
56 COMPARE(CDTR
, dd_A
, dd_B
, pun_d64
);
57 COMPARE(CDTR
, dd_B
, dd_A
, pun_d64
);
58 COMPARE(CDTR
, dd_inf
, dd_nan
, pun_d64
);
59 COMPARE(CDTR
, dd_inf
, dd_inf
, pun_d64
);
60 COMPARE(CDTR
, dd_nan
, dd_nan
, pun_d64
);
62 /* compare 16 bytes DFP value */
64 COMPARE(CXTR
, dl_A
, dl_A
, pun_d128
);
65 COMPARE(CXTR
, dl_A
, dl_B
, pun_d128
);
66 COMPARE(CXTR
, dl_B
, dl_A
, pun_d128
);
67 COMPARE(CXTR
, dl_inf
, dl_nan
, pun_d128
);
68 COMPARE(CXTR
, dl_inf
, dl_inf
, pun_d128
);
69 COMPARE(CXTR
, dl_nan
, dl_nan
, pun_d128
);
71 /* compare exponents of 8 bytes DFP value */
73 COMPARE(CEDTR
, dd_A
, dd_A
, pun_d64
);
74 COMPARE(CEDTR
, dd_A
, dd_B
, pun_d64
);
75 COMPARE(CEDTR
, dd_B
, dd_A
, pun_d64
);
76 COMPARE(CEDTR
, dd_inf
, dd_nan
, pun_d64
);
77 COMPARE(CEDTR
, dd_inf
, dd_inf
, pun_d64
);
78 COMPARE(CEDTR
, dd_nan
, dd_nan
, pun_d64
);
80 /* compare exponents of 16 bytes DFP value */
82 COMPARE(CEXTR
, dl_A
, dl_A
, pun_d128
);
83 COMPARE(CEXTR
, dl_A
, dl_B
, pun_d128
);
84 COMPARE(CEXTR
, dl_B
, dl_A
, pun_d128
);
85 COMPARE(CEXTR
, dl_inf
, dl_nan
, pun_d128
);
86 COMPARE(CEXTR
, dl_inf
, dl_inf
, pun_d128
);
87 COMPARE(CEXTR
, dl_nan
, dl_nan
, pun_d128
);