diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/compat/decimal | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/compat/decimal')
42 files changed, 1085 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/compat/decimal/compat-common.h b/gcc/testsuite/g++.dg/compat/decimal/compat-common.h new file mode 100644 index 000000000..43c22d722 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/compat-common.h @@ -0,0 +1,55 @@ +/* Several of the binary compatibility tests use these macros to + allow debugging the test or tracking down a failure by getting an + indication of whether each individual check passed or failed. + When DBG is defined, each check is shown by a dot (pass) or 'F' + (fail) rather than aborting as soon as a failure is detected. */ + +#ifdef DBG +#include <stdio.h> +#define DEBUG_INIT setbuf (stdout, NULL); +#define DEBUG_FPUTS(x) fputs (x, stdout); +#define DEBUG_DOT putc ('.', stdout); +#define DEBUG_NL putc ('\n', stdout); +#define DEBUG_FAIL putc ('F', stdout); fails++; +#define DEBUG_CHECK { DEBUG_FAIL } else { DEBUG_DOT } +#define DEBUG_FINI if (fails) DEBUG_FPUTS ("failed\n") \ + else DEBUG_FPUTS ("passed\n") +#else +#define DEBUG_INIT +#define DEBUG_FPUTS(x) +#define DEBUG_DOT +#define DEBUG_NL +#define DEBUG_FAIL abort (); +#define DEBUG_CHECK abort (); +#define DEBUG_FINI +#endif + +#ifdef SKIP_COMPLEX +#ifndef SKIP_COMPLEX_INT +#define SKIP_COMPLEX_INT +#endif +#endif + +#ifndef SKIP_COMPLEX +#ifdef __GNUC__ +#define CINT(x, y) (x + y * __extension__ 1i) +#define CDBL(x, y) (x + y * __extension__ 1i) +#else +#ifdef __SUNPRO_C +/* ??? Complex support without <complex.h>. */ +#else +#include <complex.h> +#endif +#ifndef SKIP_COMPLEX_INT +#define CINT(x, y) ((_Complex int) (x + y * _Complex_I)) +#endif +#define CDBL(x, y) (x + y * _Complex_I) +#endif +#endif + +#ifdef __cplusplus +extern "C" void abort (void); +#else +extern void abort (void); +#endif +extern int fails; diff --git a/gcc/testsuite/g++.dg/compat/decimal/decimal-dummy.h b/gcc/testsuite/g++.dg/compat/decimal/decimal-dummy.h new file mode 100644 index 000000000..ec347f9b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/decimal-dummy.h @@ -0,0 +1,67 @@ +namespace std { +namespace decimal { + + class decimal32 + { + public: + typedef float __dec32 __attribute__((mode(SD))); + decimal32 () : __val(0.e-101DF) {} + decimal32 (__dec32 x) : __val(x) {} + __dec32 __val; + }; + + class decimal64 + { + public: + typedef float __dec64 __attribute__((mode(DD))); + decimal64 () : __val(0.e-398dd) {} + decimal64 (__dec64 x) : __val(x) {} + __dec64 __val; + }; + + class decimal128 + { + public: + typedef float __dec128 __attribute__((mode(TD))); + decimal128 () : __val(0.e-6176DL) {} + decimal128 (__dec128 x) : __val(x) {} + __dec128 __val; + }; + + inline decimal32 operator+ (decimal32 lhs, decimal32 rhs) + { + decimal32 tmp; + tmp.__val = lhs.__val + rhs.__val; + return tmp; + } + + inline decimal64 operator+ (decimal64 lhs, decimal64 rhs) + { + decimal64 tmp; + tmp.__val = lhs.__val + rhs.__val; + return tmp; + } + + inline decimal128 operator+ (decimal128 lhs, decimal128 rhs) + { + decimal128 tmp; + tmp.__val = lhs.__val + rhs.__val; + return tmp; + } + + inline bool operator!= (decimal32 lhs, decimal32 rhs) + { + return lhs.__val != rhs.__val; + } + + inline bool operator!= (decimal64 lhs, decimal64 rhs) + { + return lhs.__val != rhs.__val; + } + + inline bool operator!= (decimal128 lhs, decimal128 rhs) + { + return lhs.__val != rhs.__val; + } +} +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-1_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-1_main.C new file mode 100644 index 000000000..963dc3bbf --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-1_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing decimal scalars by value. */ + +extern void pass_1_x (void); +int fails; + +int +main () +{ + pass_1_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-1_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-1_x.C new file mode 100644 index 000000000..265a1317b --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-1_x.C @@ -0,0 +1,30 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_x.h" + +void +pass_1_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-1_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-1_y.C new file mode 100644 index 000000000..5da7f87d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-1_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-2_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-2_main.C new file mode 100644 index 000000000..533e4b276 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-2_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing decimal classes by value. */ + +extern void pass_2_x (void); +int fails; + +int +main () +{ + pass_2_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-2_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-2_x.C new file mode 100644 index 000000000..8a67bda0e --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-2_x.C @@ -0,0 +1,32 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "pass_x.h" + +void +pass_2_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-2_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-2_y.C new file mode 100644 index 000000000..97471457d --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-2_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-3_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-3_main.C new file mode 100644 index 000000000..de09992c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-3_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing decimal scalars and classes by value. */ + +extern void pass_3_x (void); +int fails; + +int +main () +{ + pass_3_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-3_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-3_x.C new file mode 100644 index 000000000..17e4d1c8b --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-3_x.C @@ -0,0 +1,30 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_x.h" + +void +pass_3_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-3_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-3_y.C new file mode 100644 index 000000000..97471457d --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-3_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-4_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-4_main.C new file mode 100644 index 000000000..d5a0a47d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-4_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing decimal classes and scalars by value. */ + +extern void pass_4_x (void); +int fails; + +int +main () +{ + pass_4_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-4_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-4_x.C new file mode 100644 index 000000000..b0483ac27 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-4_x.C @@ -0,0 +1,32 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "pass_x.h" + +void +pass_4_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-4_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-4_y.C new file mode 100644 index 000000000..5da7f87d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-4_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-5_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-5_main.C new file mode 100644 index 000000000..9b25a49c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-5_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing decimal scalars and typedef'd classes by value. */ + +extern void pass_5_x (void); +int fails; + +int +main () +{ + pass_5_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-5_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-5_x.C new file mode 100644 index 000000000..11c4d96c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-5_x.C @@ -0,0 +1,30 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_x.h" + +void +pass_5_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-5_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-5_y.C new file mode 100644 index 000000000..5a2c1fba0 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-5_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +typedef std::decimal::decimal32 dec32; +typedef std::decimal::decimal64 dec64; +typedef std::decimal::decimal128 dec128; + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-6_main.C b/gcc/testsuite/g++.dg/compat/decimal/pass-6_main.C new file mode 100644 index 000000000..1b686a21d --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-6_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test passing typedef'd decimal classes and scalars by value. */ + +extern void pass_6_x (void); +int fails; + +int +main () +{ + pass_6_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-6_x.C b/gcc/testsuite/g++.dg/compat/decimal/pass-6_x.C new file mode 100644 index 000000000..e59ca7f72 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-6_x.C @@ -0,0 +1,32 @@ +#include "decimal-dummy.h" + +typedef std::decimal::decimal32 dec32; +typedef std::decimal::decimal64 dec64; +typedef std::decimal::decimal128 dec128; + +#include "pass_x.h" + +void +pass_6_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +#ifndef SKIP_DECIMAL32 +T(d32) +#endif +#ifndef SKIP_DECIMAL64 +T(d64) +#endif +#ifndef SKIP_DECIMAL128 +T(d128) +#endif + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass-6_y.C b/gcc/testsuite/g++.dg/compat/decimal/pass-6_y.C new file mode 100644 index 000000000..5da7f87d5 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass-6_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "pass_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass_x.h b/gcc/testsuite/g++.dg/compat/decimal/pass_x.h new file mode 100644 index 000000000..5b25dc9bf --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass_x.h @@ -0,0 +1,151 @@ +#include "compat-common.h" + +#define T(NAME, TYPE, INITVAL) \ +TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ + \ +extern void init##NAME (TYPE *p, TYPE v); \ +extern void checkg##NAME (void); \ +extern void \ +test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \ + TYPE x05, TYPE x06, TYPE x07, TYPE x08, \ + TYPE x09, TYPE x10, TYPE x11, TYPE x12, \ + TYPE x13, TYPE x14, TYPE x15, TYPE x16); \ +extern void testva##NAME (int n, ...); \ + \ +extern void \ +check##NAME (TYPE x, TYPE v) \ +{ \ + if (x != v + INITVAL) \ + DEBUG_CHECK \ +} \ + \ +extern void \ +test2_##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \ + TYPE x05, TYPE x06, TYPE x07, TYPE x08) \ +{ \ + test##NAME (x01, g02##NAME, x02, g04##NAME, \ + x03, g06##NAME, x04, g08##NAME, \ + x05, g10##NAME, x06, g12##NAME, \ + x07, g14##NAME, x08, g16##NAME); \ +} \ + \ +extern void \ +testit##NAME (void) \ +{ \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" init: ") \ + init##NAME (&g01##NAME, 1); \ + init##NAME (&g02##NAME, 2); \ + init##NAME (&g03##NAME, 3); \ + init##NAME (&g04##NAME, 4); \ + init##NAME (&g05##NAME, 5); \ + init##NAME (&g06##NAME, 6); \ + init##NAME (&g07##NAME, 7); \ + init##NAME (&g08##NAME, 8); \ + init##NAME (&g09##NAME, 9); \ + init##NAME (&g10##NAME, 10); \ + init##NAME (&g11##NAME, 11); \ + init##NAME (&g12##NAME, 12); \ + init##NAME (&g13##NAME, 13); \ + init##NAME (&g14##NAME, 14); \ + init##NAME (&g15##NAME, 15); \ + init##NAME (&g16##NAME, 16); \ + checkg##NAME (); \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" test: ") \ + test##NAME (g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" testva: ") \ + DEBUG_NL \ + testva##NAME (1, \ + g01##NAME); \ + DEBUG_NL \ + testva##NAME (2, \ + g01##NAME, g02##NAME); \ + DEBUG_NL \ + testva##NAME (3, \ + g01##NAME, g02##NAME, g03##NAME); \ + DEBUG_NL \ + testva##NAME (4, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME); \ + DEBUG_NL \ + testva##NAME (5, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME); \ + DEBUG_NL \ + testva##NAME (6, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME); \ + DEBUG_NL \ + testva##NAME (7, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME); \ + DEBUG_NL \ + testva##NAME (8, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME); \ + DEBUG_NL \ + testva##NAME (9, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME); \ + DEBUG_NL \ + testva##NAME (10, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME); \ + DEBUG_NL \ + testva##NAME (11, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME); \ + DEBUG_NL \ + testva##NAME (12, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME); \ + DEBUG_NL \ + testva##NAME (13, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME); \ + DEBUG_NL \ + testva##NAME (14, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME); \ + DEBUG_NL \ + testva##NAME (15, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME); \ + DEBUG_NL \ + testva##NAME (16, \ + g01##NAME, g02##NAME, g03##NAME, g04##NAME, \ + g05##NAME, g06##NAME, g07##NAME, g08##NAME, \ + g09##NAME, g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, g16##NAME); \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" test2: ") \ + test2_##NAME (g01##NAME, g03##NAME, g05##NAME, g07##NAME, \ + g09##NAME, g11##NAME, g13##NAME, g15##NAME); \ + DEBUG_NL \ +} + +T(d32, dec32, (dec32)1.5DF) +T(d64, dec64, (dec64)2.5DD) +T(d128, dec128, (dec128)3.5DL) + +#undef T diff --git a/gcc/testsuite/g++.dg/compat/decimal/pass_y.h b/gcc/testsuite/g++.dg/compat/decimal/pass_y.h new file mode 100644 index 000000000..f835b1983 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/pass_y.h @@ -0,0 +1,89 @@ +#include <stdarg.h> + +#include "compat-common.h" + +#ifdef SKIP_VA +const int test_va = 0; +#else +const int test_va = 1; +#endif + +#define T(NAME, TYPE, INITVAL) \ +extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ + \ +extern void check##NAME (TYPE x, TYPE v); \ + \ +extern void \ +init##NAME (TYPE *p, TYPE v) \ +{ \ + *p = v + INITVAL; \ +} \ + \ +extern void \ +checkg##NAME (void) \ +{ \ + check##NAME (g01##NAME, 1); \ + check##NAME (g02##NAME, 2); \ + check##NAME (g03##NAME, 3); \ + check##NAME (g04##NAME, 4); \ + check##NAME (g05##NAME, 5); \ + check##NAME (g06##NAME, 6); \ + check##NAME (g07##NAME, 7); \ + check##NAME (g08##NAME, 8); \ + check##NAME (g09##NAME, 9); \ + check##NAME (g10##NAME, 10); \ + check##NAME (g11##NAME, 11); \ + check##NAME (g12##NAME, 12); \ + check##NAME (g13##NAME, 13); \ + check##NAME (g14##NAME, 14); \ + check##NAME (g15##NAME, 15); \ + check##NAME (g16##NAME, 16); \ +} \ + \ +extern void \ +test##NAME (TYPE x01, TYPE x02, TYPE x03, TYPE x04, \ + TYPE x05, TYPE x06, TYPE x07, TYPE x08, \ + TYPE x09, TYPE x10, TYPE x11, TYPE x12, \ + TYPE x13, TYPE x14, TYPE x15, TYPE x16) \ +{ \ + check##NAME (x01, 1); \ + check##NAME (x02, 2); \ + check##NAME (x03, 3); \ + check##NAME (x04, 4); \ + check##NAME (x05, 5); \ + check##NAME (x06, 6); \ + check##NAME (x07, 7); \ + check##NAME (x08, 8); \ + check##NAME (x09, 9); \ + check##NAME (x10, 10); \ + check##NAME (x11, 11); \ + check##NAME (x12, 12); \ + check##NAME (x13, 13); \ + check##NAME (x14, 14); \ + check##NAME (x15, 15); \ + check##NAME (x16, 16); \ +} \ + \ +extern void \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + va_list ap; \ + if (test_va) \ + { \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + { \ + TYPE t = va_arg (ap, TYPE); \ + check##NAME (t, i+1); \ + } \ + va_end (ap); \ + } \ +} + +T(d32, dec32, (dec32)1.5DF) +T(d64, dec64, (dec64)2.5DD) +T(d128, dec128, (dec128)3.5DL) diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-1_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-1_main.C new file mode 100644 index 000000000..c663bb01c --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-1_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for decimal float scalars. */ + +extern void return_1_x (void); +int fails; + +int +main () +{ + return_1_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-1_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-1_x.C new file mode 100644 index 000000000..e391bd1f1 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-1_x.C @@ -0,0 +1,24 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_x.h" + +void +return_1_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-1_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-1_y.C new file mode 100644 index 000000000..0b4d4bf38 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-1_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-2_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-2_main.C new file mode 100644 index 000000000..afa27f269 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-2_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for decimal classes. */ + +extern void return_2_x (void); +int fails; + +int +main () +{ + return_2_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-2_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-2_x.C new file mode 100644 index 000000000..d96c01479 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-2_x.C @@ -0,0 +1,26 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "return_x.h" + +void +return_2_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-2_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-2_y.C new file mode 100644 index 000000000..c68088b30 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-2_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-3_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-3_main.C new file mode 100644 index 000000000..468f3fc0c --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-3_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for decimal float scalars and classes. */ + +extern void return_3_x (void); +int fails; + +int +main () +{ + return_3_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-3_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-3_x.C new file mode 100644 index 000000000..52e599c76 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-3_x.C @@ -0,0 +1,24 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_x.h" + +void +return_3_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-3_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-3_y.C new file mode 100644 index 000000000..c68088b30 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-3_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-4_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-4_main.C new file mode 100644 index 000000000..365d8becd --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-4_main.C @@ -0,0 +1,13 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for decimal float classes and scalars. */ + +extern void return_4_x (void); +int fails; + +int +main () +{ + return_4_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-4_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-4_x.C new file mode 100644 index 000000000..b9d28fa5b --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-4_x.C @@ -0,0 +1,26 @@ +#include "decimal-dummy.h" + +#define dec32 std::decimal::decimal32 +#define dec64 std::decimal::decimal64 +#define dec128 std::decimal::decimal128 + +#include "return_x.h" + +void +return_4_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-4_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-4_y.C new file mode 100644 index 000000000..0b4d4bf38 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-4_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-5_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-5_main.C new file mode 100644 index 000000000..2c3348327 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-5_main.C @@ -0,0 +1,14 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for decimal float scalars and typedef'd + classes. */ + +extern void return_5_x (void); +int fails; + +int +main () +{ + return_5_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-5_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-5_x.C new file mode 100644 index 000000000..a2bb6173b --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-5_x.C @@ -0,0 +1,24 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_x.h" + +void +return_5_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-5_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-5_y.C new file mode 100644 index 000000000..0f780167a --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-5_y.C @@ -0,0 +1,7 @@ +#include "decimal-dummy.h" + +typedef std::decimal::decimal32 dec32; +typedef std::decimal::decimal64 dec64; +typedef std::decimal::decimal128 dec128; + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-6_main.C b/gcc/testsuite/g++.dg/compat/decimal/return-6_main.C new file mode 100644 index 000000000..94526bdcb --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-6_main.C @@ -0,0 +1,14 @@ +/* { dg-require-effective-target dfp } */ + +/* Test function return values for typedef'd decimal float classes + and scalars. */ + +extern void return_6_x (void); +int fails; + +int +main () +{ + return_6_x (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-6_x.C b/gcc/testsuite/g++.dg/compat/decimal/return-6_x.C new file mode 100644 index 000000000..e0a487dbe --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-6_x.C @@ -0,0 +1,26 @@ +#include "decimal-dummy.h" + +typedef std::decimal::decimal32 dec32; +typedef std::decimal::decimal64 dec64; +typedef std::decimal::decimal128 dec128; + +#include "return_x.h" + +void +return_6_x (void) +{ +DEBUG_INIT + +#define T(NAME) testit##NAME (); + +T(d32) +T(d64) +T(d128) + +DEBUG_FINI + +if (fails != 0) + abort (); + +#undef T +} diff --git a/gcc/testsuite/g++.dg/compat/decimal/return-6_y.C b/gcc/testsuite/g++.dg/compat/decimal/return-6_y.C new file mode 100644 index 000000000..0b4d4bf38 --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return-6_y.C @@ -0,0 +1,5 @@ +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +#include "return_y.h" diff --git a/gcc/testsuite/g++.dg/compat/decimal/return_x.h b/gcc/testsuite/g++.dg/compat/decimal/return_x.h new file mode 100644 index 000000000..401adfb5c --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return_x.h @@ -0,0 +1,90 @@ +#include "compat-common.h" + +#ifdef SKIP_VA +const int test_va = 0; +#else +const int test_va = 1; +#endif + +#define T(NAME, TYPE, INITVAL) \ +TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ + \ +extern void init##NAME (TYPE *p, TYPE v); \ +extern void checkg##NAME (void); \ +extern TYPE test0##NAME (void); \ +extern TYPE test1##NAME (TYPE); \ +extern TYPE testva##NAME (int n, ...); \ + \ +extern void \ +check##NAME (TYPE x, TYPE v) \ +{ \ + if (x != v) \ + DEBUG_CHECK \ +} \ + \ +extern void \ +testit##NAME (void) \ +{ \ + TYPE rslt; \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" init: ") \ + init##NAME (&g01##NAME, 1); \ + init##NAME (&g02##NAME, 2); \ + init##NAME (&g03##NAME, 3); \ + init##NAME (&g04##NAME, 4); \ + init##NAME (&g05##NAME, 5); \ + init##NAME (&g06##NAME, 6); \ + init##NAME (&g07##NAME, 7); \ + init##NAME (&g08##NAME, 8); \ + init##NAME (&g09##NAME, 9); \ + init##NAME (&g10##NAME, 10); \ + init##NAME (&g11##NAME, 11); \ + init##NAME (&g12##NAME, 12); \ + init##NAME (&g13##NAME, 13); \ + init##NAME (&g14##NAME, 14); \ + init##NAME (&g15##NAME, 15); \ + init##NAME (&g16##NAME, 16); \ + checkg##NAME (); \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" test0: ") \ + rslt = test0##NAME (); \ + check##NAME (rslt, g01##NAME); \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" test1: ") \ + rslt = test1##NAME (g01##NAME); \ + check##NAME (rslt, g01##NAME); \ + if (test_va) \ + { \ + DEBUG_NL \ + DEBUG_FPUTS (#NAME) \ + DEBUG_FPUTS (" testva: ") \ + rslt = testva##NAME (1, g01##NAME); \ + check##NAME (rslt, g01##NAME); \ + rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME); \ + check##NAME (rslt, g05##NAME); \ + rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME); \ + check##NAME (rslt, g09##NAME); \ + rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \ + g04##NAME, g05##NAME, g06##NAME, \ + g07##NAME, g08##NAME, g09##NAME, \ + g10##NAME, g11##NAME, g12##NAME, \ + g13##NAME, g14##NAME, g15##NAME, \ + g16##NAME); \ + check##NAME (rslt, g16##NAME); \ + } \ + DEBUG_NL \ +} + +T(d32, dec32, (dec32)1.5DF); +T(d64, dec64, (dec64)2.5DD); +T(d128, dec128, (dec128)3.5DL); + +#undef T diff --git a/gcc/testsuite/g++.dg/compat/decimal/return_y.h b/gcc/testsuite/g++.dg/compat/decimal/return_y.h new file mode 100644 index 000000000..285526e2e --- /dev/null +++ b/gcc/testsuite/g++.dg/compat/decimal/return_y.h @@ -0,0 +1,67 @@ +#include <stdarg.h> + +#include "compat-common.h" + +#define T(NAME, TYPE, INITVAL) \ +extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \ +extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \ +extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \ +extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \ + \ +extern void check##NAME (TYPE x, TYPE v); \ + \ +extern void \ +init##NAME (TYPE *p, TYPE v) \ +{ \ + *p = v + INITVAL; \ +} \ + \ +extern void \ +checkg##NAME (void) \ +{ \ + check##NAME (g01##NAME, 1+INITVAL); \ + check##NAME (g02##NAME, 2+INITVAL); \ + check##NAME (g03##NAME, 3+INITVAL); \ + check##NAME (g04##NAME, 4+INITVAL); \ + check##NAME (g05##NAME, 5+INITVAL); \ + check##NAME (g06##NAME, 6+INITVAL); \ + check##NAME (g07##NAME, 7+INITVAL); \ + check##NAME (g08##NAME, 8+INITVAL); \ + check##NAME (g09##NAME, 9+INITVAL); \ + check##NAME (g10##NAME, 10+INITVAL); \ + check##NAME (g11##NAME, 11+INITVAL); \ + check##NAME (g12##NAME, 12+INITVAL); \ + check##NAME (g13##NAME, 13+INITVAL); \ + check##NAME (g14##NAME, 14+INITVAL); \ + check##NAME (g15##NAME, 15+INITVAL); \ + check##NAME (g16##NAME, 16+INITVAL); \ +} \ + \ +extern TYPE \ +test0##NAME (void) \ +{ \ + return g01##NAME; \ +} \ + \ +extern TYPE \ +test1##NAME (TYPE x01) \ +{ \ + return x01; \ +} \ + \ +extern TYPE \ +testva##NAME (int n, ...) \ +{ \ + int i; \ + TYPE rslt; \ + va_list ap; \ + va_start (ap, n); \ + for (i = 0; i < n; i++) \ + rslt = va_arg (ap, TYPE); \ + va_end (ap); \ + return rslt; \ +} + +T(d32, dec32, (dec32)1.5) +T(d64, dec64, (dec64)2.5) +T(d128, dec128, (dec128)3.5) |