#include #include /* 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<