From 3c9085936228ac479154971fc23f5fbf2e85af0c Mon Sep 17 00:00:00 2001 From: janis Date: Thu, 17 Sep 2009 17:07:24 +0000 Subject: [PATCH] gcc/ PR c/41049 * real.c decimal_from_integer, decimal_integer_string): New. (real_from_integer): Use them as special case for decimal float. * config/dfp-bit.c (_si_to_sd, _usi_to_sd): Use default rounding. (_di_to_sd, _di_to_dd, _di_to_td, _udi_to_sd, _udi_to_dd, _udi_to_td): Do not append zero after the decimal point in string to convert. gcc/testsuite/ PR c/41049 * dfp/pr41049.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151806 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 + gcc/config/dfp-bit.c | 3 +- gcc/real.c | 65 ++++- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/gcc.dg/dfp/pr41049.c | 562 +++++++++++++++++++++++++++++++++++++ 5 files changed, 641 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/dfp/pr41049.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 923a9613e86..27276f90464 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-09-17 Janis Johnson + + PR c/41049 + * real.c decimal_from_integer, decimal_integer_string): New. + (real_from_integer): Use them as special case for decimal float. + * config/dfp-bit.c (_si_to_sd, _usi_to_sd): Use default rounding. + (_di_to_sd, _di_to_dd, _di_to_td, _udi_to_sd, _udi_to_dd, _udi_to_td): + Do not append zero after the decimal point in string to convert. + 2009-09-17 Alexander Monakov * graphite-sese-to-poly.c (pdr_add_data_dimensions): Add bounds only diff --git a/gcc/config/dfp-bit.c b/gcc/config/dfp-bit.c index d315d5b56f0..19f2fdae67d 100644 --- a/gcc/config/dfp-bit.c +++ b/gcc/config/dfp-bit.c @@ -568,7 +568,6 @@ INT_TO_DFP (INT_TYPE i) decContext context; decContextDefault (&context, DEC_INIT_DECIMAL128); - context.round = DEC_ROUND_DOWN; f64 = *DEC_FLOAT_FROM_INT (&f64, i); u32.f = *decSingleFromWider (&u32.f, &f64, &context); if (DFP_EXCEPTIONS_ENABLED && context.status != 0) @@ -593,7 +592,7 @@ INT_TO_DFP (INT_TYPE i) DFP_INIT_ROUNDMODE (context.round); /* Use a C library function to get a floating point string. */ - sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(i)); + sprintf (buf, INT_FMT ".", CAST_FOR_FMT(i)); /* Convert from the floating point string to a decimal* type. */ FROM_STRING (&s, buf, &context); IEEE_TO_HOST (s, &f); diff --git a/gcc/real.c b/gcc/real.c index f4c493bd041..eb4e25bba83 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -110,6 +110,9 @@ static int do_compare (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int); static void do_fix_trunc (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); static unsigned long rtd_divmod (REAL_VALUE_TYPE *, REAL_VALUE_TYPE *); +static void decimal_from_integer (REAL_VALUE_TYPE *); +static void decimal_integer_string (char *, const REAL_VALUE_TYPE *, + size_t); static const REAL_VALUE_TYPE * ten_to_ptwo (int); static const REAL_VALUE_TYPE * ten_to_mptwo (int); @@ -2168,10 +2171,70 @@ real_from_integer (REAL_VALUE_TYPE *r, enum machine_mode mode, normalize (r); } - if (mode != VOIDmode) + if (DECIMAL_FLOAT_MODE_P (mode)) + decimal_from_integer (r); + else if (mode != VOIDmode) real_convert (r, mode, r); } +/* Render R, an integral value, as a floating point constant with no + specified exponent. */ + +static void +decimal_integer_string (char *str, const REAL_VALUE_TYPE *r_orig, + size_t buf_size) +{ + int dec_exp, digit, digits; + REAL_VALUE_TYPE r, pten; + char *p; + bool sign; + + r = *r_orig; + + if (r.cl == rvc_zero) + { + strcpy (str, "0."); + return; + } + + sign = r.sign; + r.sign = 0; + + dec_exp = REAL_EXP (&r) * M_LOG10_2; + digits = dec_exp + 1; + gcc_assert ((digits + 2) < (int)buf_size); + + pten = *real_digit (1); + times_pten (&pten, dec_exp); + + p = str; + if (sign) + *p++ = '-'; + + digit = rtd_divmod (&r, &pten); + gcc_assert (digit >= 0 && digit <= 9); + *p++ = digit + '0'; + while (--digits > 0) + { + times_pten (&r, 1); + digit = rtd_divmod (&r, &pten); + *p++ = digit + '0'; + } + *p++ = '.'; + *p++ = '\0'; +} + +/* Convert a real with an integral value to decimal float. */ + +static void +decimal_from_integer (REAL_VALUE_TYPE *r) +{ + char str[256]; + + decimal_integer_string (str, r, sizeof (str) - 1); + decimal_real_from_string (r, str); +} + /* Returns 10**2**N. */ static const REAL_VALUE_TYPE * diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e3845076a3..c6270142d4a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-09-17 Janis Johnson + + PR c/41049 + * dfp/pr41049.c: New test. + 2009-09-17 H.J. Lu PR testsuite/41385 diff --git a/gcc/testsuite/gcc.dg/dfp/pr41049.c b/gcc/testsuite/gcc.dg/dfp/pr41049.c new file mode 100644 index 00000000000..6187481eca1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/pr41049.c @@ -0,0 +1,562 @@ +/* { dg-options "-std=gnu99" } */ + +/* The preferred exponent of the result of a conversion from an + integral type to a decimal float type is zero. A conversion at + either compile time or runtime should not change the number of + trailing zeroes. */ + +#include "dfp-dbg.h" + +#define PASTE2(A,B) A ## B +#define PASTE(A,B) PASTE2(A,B) + +#define TESTVAL_NEG(VAL,SUF,SIZE) \ + x = PASTE(PASTE(VAL,.),SUF); \ + si = VAL; \ + sll = PASTE(VAL,LL); \ + a = si; \ + b = sll; \ + c = VAL; \ + d = PASTE(VAL,LL); \ + if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&c,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&d,SIZE) != 0)) \ + FAILURE + +#define TESTVAL_NEG_BIG(VAL,SUF,SIZE) \ + x = PASTE(PASTE(VAL,.),SUF); \ + sll = PASTE(VAL,LL); \ + a = sll; \ + b = PASTE(VAL,LL); \ + if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0)) \ + FAILURE + +#define TESTVAL_NONNEG(VAL,SUF,SIZE) \ + x = PASTE(PASTE(VAL,.),SUF); \ + si = VAL; \ + ui = VAL; \ + sll = PASTE(VAL,LL); \ + ull = PASTE(VAL,ULL); \ + a = si; \ + b = sll; \ + c = ui; \ + d = ull; \ + e = VAL; \ + f = VAL; \ + g = PASTE(VAL,LL); \ + h = PASTE(VAL,ULL); \ + if ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&c,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&d,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&e,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&f,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&g,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&x, (void *)&h,SIZE) != 0)) \ + FAILURE + +#define TESTVAL_NONNEG_BIG(VAL,SUF,SIZE) \ + x = PASTE(PASTE(VAL,.),SUF); \ + sll = PASTE(VAL,LL); \ + ull = PASTE(VAL,ULL); \ + b = sll; \ + d = ull; \ + f = PASTE(VAL,LL); \ + g = PASTE(VAL,ULL); \ + if ((__builtin_memcmp ((void *)&x, (void *)&b, SIZE) != 0) \ + || (__builtin_memcmp ((void *)&d, (void *)&d,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&f, (void *)&d,SIZE) != 0) \ + || (__builtin_memcmp ((void *)&g, (void *)&d,SIZE) != 0)) \ + FAILURE + +#undef SUFFIX +#define SUFFIX DF +#undef TYPE +#define TYPE _Decimal32 + +void +zeroes_32 (void) +{ + volatile TYPE x, a, b, c, d, e, f, g, h; + volatile int si; + volatile unsigned int ui; + volatile long long sll; + volatile unsigned long long ull; + + TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE)); + + TESTVAL_NEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE)); +} + +void +round_32 (void) +{ + volatile TYPE x, a, b, c, d, e, f, g, h; + volatile int si; + volatile unsigned int ui; + volatile long long sll; + volatile unsigned long long ull; + + TESTVAL_NONNEG (10000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000050, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000001, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000002, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000003, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000004, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000006, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000007, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000008, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000009, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000010, SUFFIX, sizeof (TYPE)); + + TESTVAL_NEG (-10000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000050, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000001, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000002, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000003, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000004, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000006, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000007, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000008, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000009, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000010, SUFFIX, sizeof (TYPE)); +} + +#undef SUFFIX +#define SUFFIX DD +#undef TYPE +#define TYPE _Decimal64 + +void +zeroes_64 (void) +{ + volatile TYPE x, a, b, c, d, e, f, g, h; + volatile int si; + volatile unsigned int ui; + volatile long long sll; + volatile unsigned long long ull; + + TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE)); + + TESTVAL_NEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE)); +} + +void +round_64 (void) +{ + volatile TYPE x, a, b, c, d, e, f, g, h; + volatile int si; + volatile unsigned int ui; + volatile long long sll; + volatile unsigned long long ull; + + TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000001, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000002, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000003, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000004, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000006, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000007, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000008, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000009, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000010, SUFFIX, sizeof (TYPE)); + + TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000001, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000002, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000003, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000004, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000049, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000051, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000006, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000007, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000008, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000009, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000010, SUFFIX, sizeof (TYPE)); +} + +#undef SUFFIX +#define SUFFIX DL +#undef TYPE +#define TYPE _Decimal128 + +void +zeroes_128 (void) +{ + volatile TYPE x, a, b, c, d, e, f, g, h; + volatile int si; + volatile unsigned int ui; + volatile long long sll; + volatile unsigned long long ull; + + TESTVAL_NONNEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG (1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NONNEG_BIG (9000000000000000000, SUFFIX, sizeof (TYPE)); + + TESTVAL_NEG (0, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-5000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-9000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-10000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-50000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-90000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-100000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-500000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-900000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG (-1000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-10000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-50000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-90000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-100000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-500000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-900000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-1000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-5000000000000000000, SUFFIX, sizeof (TYPE)); + TESTVAL_NEG_BIG (-9000000000000000000, SUFFIX, sizeof (TYPE)); +} + + +int +main () +{ + zeroes_32 (); + zeroes_64 (); + zeroes_128 (); + round_32 (); + round_64 (); + + FINISH +} -- 2.11.4.GIT