aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/decimal
diff options
context:
space:
mode:
authorBenjamin Kosnik <bkoz@gcc.gnu.org>2009-10-05 17:42:00 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2009-10-05 17:42:00 +0000
commit4cdc876153cc0ddcda76174f868e1722f389be04 (patch)
tree96b34fadf9c78b6f9e01a6f3cdd1675170a3d996 /libstdc++-v3/testsuite/decimal
parent8fc7e474ff38a3b4219f552597673cec1ed58e9f (diff)
downloadgcc-4cdc876153cc0ddcda76174f868e1722f389be04.zip
gcc-4cdc876153cc0ddcda76174f868e1722f389be04.tar.gz
gcc-4cdc876153cc0ddcda76174f868e1722f389be04.tar.bz2
[multiple changes]
2009-10-05 Benjamin Kosnik <bkoz@redhat.com> Edward Smith-Rowland <3dw4rd@verizon.net> * include/decimal/decimal: Warn if decimal floating point types are not available. * acinclude.m4 (GLIBCXX_ENABLE_DECIMAL_FLOAT): New. * configure.ac: Use it. * configure: Regenerate. * config.h.in: Regenerate. 2009-10-05 Benjamin Kosnik <bkoz@redhat.com> * include/Makefile.am: Remove stray line break. * include/decimal/decimal: Brief class doxygen markup. * libsupc++/exception: Whitespace cleanup. * testsuite/libstdc++-dg/conformance.exp: Add testsuite directory decimal. * scripts/create_testsuite_files (dlist): Same. * doc/xml/manual/using.xml: One column in table. Move after TR1. * testsuite/decimal/bad-cast.cc: Move to... * testsuite/decimal/cast_neg.cc: ...here. * testsuite/decimal/bad-mixed-mode.cc: Move to... * testsuite/decimal/mixed-mode_neg.cc: ...here. * testsuite/decimal/bad-operator.cc: Move to... * testsuite/decimal/operator_neg.cc: ...here. * doc/doxygen/user.cfg.in (INPUT): Add decimal/decimal. 2009-10-05 Janis Johnson <janis187@us.ibm.com> * doc/Makefile.am: Process new file. * doc/xml/manual/intro.xml: Ditto. * doc/xml/manual/using.xml: Document new header. * doc/xml/manual/status_cxxdecimal.xml: New file. * include/Makefile.am: Process new headers. * include/decimal/decimal: New file. * include/decimal/decimal.h: New file. 2009-10-05 Janis Johnson <janis187@us.ibm.com> * testsuite/decimal: New directory. * testsuite/decimal/bad-cast.cc: New test. * testsuite/decimal/bad-mixed-mode.cc: New test. * testsuite/decimal/bad-operator.cc: New test. * testsuite/decimal/binary-arith.cc: New test. * testsuite/decimal/comparison.cc: New test. * testsuite/decimal/compound-assignment.cc: New test. * testsuite/decimal/compound-assignment-memfunc.cc: New test. * testsuite/decimal/conversion-from-float.cc: New test. * testsuite/decimal/conversion-from-integral.cc: New test. * testsuite/decimal/conversion-to-generic-float.cc: New test. * testsuite/decimal/conversion-to-integral.cc: New test. * testsuite/decimal/ctor.cc: New test. * testsuite/decimal/incdec.cc: New test. * testsuite/decimal/incdec-memfunc.cc: New test. * testsuite/decimal/make-decimal.cc: New test. * testsuite/decimal/unary-arith.cc: New test. From-SVN: r152457
Diffstat (limited to 'libstdc++-v3/testsuite/decimal')
-rw-r--r--libstdc++-v3/testsuite/decimal/binary-arith.cc372
-rw-r--r--libstdc++-v3/testsuite/decimal/cast_neg.cc62
-rw-r--r--libstdc++-v3/testsuite/decimal/comparison.cc546
-rw-r--r--libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc250
-rw-r--r--libstdc++-v3/testsuite/decimal/compound-assignment.cc248
-rw-r--r--libstdc++-v3/testsuite/decimal/conversion-from-float.cc101
-rw-r--r--libstdc++-v3/testsuite/decimal/conversion-from-integral.cc193
-rw-r--r--libstdc++-v3/testsuite/decimal/conversion-to-generic-float.cc105
-rw-r--r--libstdc++-v3/testsuite/decimal/conversion-to-integral.cc85
-rw-r--r--libstdc++-v3/testsuite/decimal/ctor.cc65
-rw-r--r--libstdc++-v3/testsuite/decimal/incdec-memfunc.cc181
-rw-r--r--libstdc++-v3/testsuite/decimal/incdec.cc179
-rw-r--r--libstdc++-v3/testsuite/decimal/make-decimal.cc132
-rw-r--r--libstdc++-v3/testsuite/decimal/mixed-mode_neg.cc206
-rw-r--r--libstdc++-v3/testsuite/decimal/operator_neg.cc160
-rw-r--r--libstdc++-v3/testsuite/decimal/unary-arith.cc93
16 files changed, 2978 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/decimal/binary-arith.cc b/libstdc++-v3/testsuite/decimal/binary-arith.cc
new file mode 100644
index 0000000..e613ff0
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/binary-arith.cc
@@ -0,0 +1,372 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.8 Binary arithmetic operators.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 d32 (5);
+decimal64 d64 (-10);
+decimal128 d128 (25);
+int si = -20;
+unsigned int ui = 50;
+long sl = -10;
+unsigned long ul = 20;
+long long sll = -25;
+unsigned long long ull = 50;
+
+void
+binary_add_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = si + a; VERIFY (b == 980);
+ b = ui + a; VERIFY (b == 1050);
+ b = sl + a; VERIFY (b == 990);
+ b = ul + a; VERIFY (b == 1020);
+ b = sll + a; VERIFY (b == 975);
+ b = ull + a; VERIFY (b == 1050);
+ b = d32 + a; VERIFY (b == 1005);
+ b = (decimal32)(d64 + a); VERIFY (b == 990);
+ b = (decimal32)(d128 + a); VERIFY (b == 1025);
+
+ b = a + si; VERIFY (b == 980);
+ b = a + ui; VERIFY (b == 1050);
+ b = a + sl; VERIFY (b == 990);
+ b = a + ul; VERIFY (b == 1020);
+ b = a + sll; VERIFY (b == 975);
+ b = a + ull; VERIFY (b == 1050);
+ b = a + d32; VERIFY (b == 1005);
+ b = (decimal32)(a + d64); VERIFY (b == 990);
+ b = (decimal32)(a + d128); VERIFY (b == 1025);
+}
+
+void
+binary_subtract_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a - si; VERIFY (b == 1020);
+ b = a - ui; VERIFY (b == 950);
+ b = a - sl; VERIFY (b == 1010);
+ b = a - ul; VERIFY (b == 980);
+ b = a - sll; VERIFY (b == 1025);
+ b = a - ull; VERIFY (b == 950);
+ b = a - d32; VERIFY (b == 995);
+ b = (decimal32)(a - d64); VERIFY (b == 1010);
+ b = (decimal32)(a - d128); VERIFY (b == 975);
+
+ a = -1000;
+ b = si - a; VERIFY (b == 980);
+ b = ui - a; VERIFY (b == 1050);
+ b = sl - a; VERIFY (b == 990);
+ b = ul - a; VERIFY (b == 1020);
+ b = sll - a; VERIFY (b == 975);
+ b = ull - a; VERIFY (b == 1050);
+ b = d32 - a; VERIFY (b == 1005);
+ b = (decimal32)(d64 - a); VERIFY (b == 990);
+ b = (decimal32)(d128 - a); VERIFY (b == 1025);
+}
+
+void
+binary_multiply_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a * si; VERIFY (b == -20000);
+ b = a * ui; VERIFY (b == 50000);
+ b = a * sl; VERIFY (b == -10000);
+ b = a * ul; VERIFY (b == 20000);
+ b = a * sll; VERIFY (b == -25000);
+ b = a * ull; VERIFY (b == 50000);
+ b = a * d32; VERIFY (b == 5000);
+ b = (decimal32)(a * d64); VERIFY (b == -10000);
+ b = (decimal32)(a * d128); VERIFY (b == 25000);
+
+ b = si * a; VERIFY (b == -20000);
+ b = ui * a; VERIFY (b == 50000);
+ b = sl * a; VERIFY (b == -10000);
+ b = ul * a; VERIFY (b == 20000);
+ b = sll * a; VERIFY (b == -25000);
+ b = ull * a; VERIFY (b == 50000);
+ b = d32 * a; VERIFY (b == 5000);
+ b = (decimal32)(d64 * a); VERIFY (b == -10000);
+ b = (decimal32)(d128 * a); VERIFY (b == 25000);
+}
+
+void
+binary_divide_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a / si; VERIFY (b == -50);
+ b = a / ui; VERIFY (b == 20);
+ b = a / sl; VERIFY (b == -100);
+ b = a / ul; VERIFY (b == 50);
+ b = a / sll; VERIFY (b == -40);
+ b = a / ull; VERIFY (b == 20);
+ b = a / d32; VERIFY (b == 200);
+ b = (decimal32)(a / d64); VERIFY (b == -100);
+ b = (decimal32)(a / d128); VERIFY (b == 40);
+
+ a = 5;
+ b = si / a; VERIFY (b == -4);
+ b = ui / a; VERIFY (b == 10);
+ b = sl / a; VERIFY (b == -2);
+ b = ul / a; VERIFY (b == 4);
+ b = sll / a; VERIFY (b == -5);
+ b = ull / a; VERIFY (b == 10);
+ b = d32 / a; VERIFY (b == 1);
+ b = (decimal32)(d64 / a); VERIFY (b == -2);
+ b = (decimal32)(d128 / a); VERIFY (b == 5);
+}
+
+void
+binary_add_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a + si; VERIFY (b == 980);
+ b = a + ui; VERIFY (b == 1050);
+ b = a + sl; VERIFY (b == 990);
+ b = a + ul; VERIFY (b == 1020);
+ b = a + sll; VERIFY (b == 975);
+ b = a + ull; VERIFY (b == 1050);
+ b = a + d32; VERIFY (b == 1005);
+ b = a + d64; VERIFY (b == 990);
+ b = (decimal64)(a + d128); VERIFY (b == 1025);
+
+ b = a + si; VERIFY (b == 980);
+ b = a + ui; VERIFY (b == 1050);
+ b = a + sl; VERIFY (b == 990);
+ b = a + ul; VERIFY (b == 1020);
+ b = a + sll; VERIFY (b == 975);
+ b = a + ull; VERIFY (b == 1050);
+ b = a + d32; VERIFY (b == 1005);
+ b = a + d64; VERIFY (b == 990);
+ b = (decimal64)(a + d128); VERIFY (b == 1025);
+}
+
+void
+binary_subtract_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a - si; VERIFY (b == 1020);
+ b = a - ui; VERIFY (b == 950);
+ b = a - sl; VERIFY (b == 1010);
+ b = a - ul; VERIFY (b == 980);
+ b = a - sll; VERIFY (b == 1025);
+ b = a - ull; VERIFY (b == 950);
+ b = a - d32; VERIFY (b == 995);
+ b = a - d64; VERIFY (b == 1010);
+ b = (decimal64)(a - d128); VERIFY (b == 975);
+
+ a = -1000;
+ b = si - a; VERIFY (b == 980);
+ b = ui - a; VERIFY (b == 1050);
+ b = sl - a; VERIFY (b == 990);
+ b = ul - a; VERIFY (b == 1020);
+ b = sll - a; VERIFY (b == 975);
+ b = ull - a; VERIFY (b == 1050);
+ b = d32 - a; VERIFY (b == 1005);
+ b = d64 - a; VERIFY (b == 990);
+ b = (decimal64)(d128 - a); VERIFY (b == 1025);
+}
+
+void
+binary_multiply_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a * si; VERIFY (b == -20000);
+ b = a * ui; VERIFY (b == 50000);
+ b = a * sl; VERIFY (b == -10000);
+ b = a * ul; VERIFY (b == 20000);
+ b = a * sll; VERIFY (b == -25000);
+ b = a * ull; VERIFY (b == 50000);
+ b = a * d32; VERIFY (b == 5000);
+ b = a * d64; VERIFY (b == -10000);
+ b = (decimal64)(a * d128); VERIFY (b == 25000);
+
+ b = si * a; VERIFY (b == -20000);
+ b = ui * a; VERIFY (b == 50000);
+ b = sl * a; VERIFY (b == -10000);
+ b = ul * a; VERIFY (b == 20000);
+ b = sll * a; VERIFY (b == -25000);
+ b = ull * a; VERIFY (b == 50000);
+ b = d32 * a; VERIFY (b == 5000);
+ b = d64 * a; VERIFY (b == -10000);
+ b = (decimal64)(d128 * a); VERIFY (b == 25000);
+}
+
+void
+binary_divide_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a / si; VERIFY (b == -50);
+ b = a / ui; VERIFY (b == 20);
+ b = a / sl; VERIFY (b == -100);
+ b = a / ul; VERIFY (b == 50);
+ b = a / sll; VERIFY (b == -40);
+ b = a / ull; VERIFY (b == 20);
+ b = a / d32; VERIFY (b == 200);
+ b = a / d64; VERIFY (b == -100);
+ b = (decimal64)(a / d128); VERIFY (b == 40);
+
+ a = 5;
+ b = si / a; VERIFY (b == -4);
+ b = ui / a; VERIFY (b == 10);
+ b = sl / a; VERIFY (b == -2);
+ b = ul / a; VERIFY (b == 4);
+ b = sll / a; VERIFY (b == -5);
+ b = ull / a; VERIFY (b == 10);
+ b = d32 / a; VERIFY (b == 1);
+ b = d64 / a; VERIFY (b == -2);
+ b = (decimal64)(d128 / a); VERIFY (b == 5);
+}
+
+void
+binary_add_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a + si; VERIFY (b == 980);
+ b = a + ui; VERIFY (b == 1050);
+ b = a + sl; VERIFY (b == 990);
+ b = a + ul; VERIFY (b == 1020);
+ b = a + sll; VERIFY (b == 975);
+ b = a + ull; VERIFY (b == 1050);
+ b = a + d32; VERIFY (b == 1005);
+ b = a + d64; VERIFY (b == 990);
+ b = a + d128; VERIFY (b == 1025);
+
+ b = a + si; VERIFY (b == 980);
+ b = a + ui; VERIFY (b == 1050);
+ b = a + sl; VERIFY (b == 990);
+ b = a + ul; VERIFY (b == 1020);
+ b = a + sll; VERIFY (b == 975);
+ b = a + ull; VERIFY (b == 1050);
+ b = a + d32; VERIFY (b == 1005);
+ b = a + d64; VERIFY (b == 990);
+ b = a + d128; VERIFY (b == 1025);
+}
+
+void
+binary_subtract_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a - si; VERIFY (b == 1020);
+ b = a - ui; VERIFY (b == 950);
+ b = a - sl; VERIFY (b == 1010);
+ b = a - ul; VERIFY (b == 980);
+ b = a - sll; VERIFY (b == 1025);
+ b = a - ull; VERIFY (b == 950);
+ b = a - d32; VERIFY (b == 995);
+ b = a - d64; VERIFY (b == 1010);
+ b = a - d128; VERIFY (b == 975);
+
+ a = -1000;
+ b = si - a; VERIFY (b == 980);
+ b = ui - a; VERIFY (b == 1050);
+ b = sl - a; VERIFY (b == 990);
+ b = ul - a; VERIFY (b == 1020);
+ b = sll - a; VERIFY (b == 975);
+ b = ull - a; VERIFY (b == 1050);
+ b = d32 - a; VERIFY (b == 1005);
+ b = d64 - a; VERIFY (b == 990);
+ b = d128 - a; VERIFY (b == 1025);
+}
+
+void
+binary_multiply_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a * si; VERIFY (b == -20000);
+ b = a * ui; VERIFY (b == 50000);
+ b = a * sl; VERIFY (b == -10000);
+ b = a * ul; VERIFY (b == 20000);
+ b = a * sll; VERIFY (b == -25000);
+ b = a * ull; VERIFY (b == 50000);
+ b = a * d32; VERIFY (b == 5000);
+ b = a * d64; VERIFY (b == -10000);
+ b = a * d128; VERIFY (b == 25000);
+
+ b = si * a; VERIFY (b == -20000);
+ b = ui * a; VERIFY (b == 50000);
+ b = sl * a; VERIFY (b == -10000);
+ b = ul * a; VERIFY (b == 20000);
+ b = sll * a; VERIFY (b == -25000);
+ b = ull * a; VERIFY (b == 50000);
+ b = d32 * a; VERIFY (b == 5000);
+ b = d64 * a; VERIFY (b == -10000);
+ b = d128 * a; VERIFY (b == 25000);
+}
+
+void
+binary_divide_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a / si; VERIFY (b == -50);
+ b = a / ui; VERIFY (b == 20);
+ b = a / sl; VERIFY (b == -100);
+ b = a / ul; VERIFY (b == 50);
+ b = a / sll; VERIFY (b == -40);
+ b = a / ull; VERIFY (b == 20);
+ b = a / d32; VERIFY (b == 200);
+ b = a / d64; VERIFY (b == -100);
+ b = a / d128; VERIFY (b == 40);
+
+ a = 5;
+ b = si / a; VERIFY (b == -4);
+ b = ui / a; VERIFY (b == 10);
+ b = sl / a; VERIFY (b == -2);
+ b = ul / a; VERIFY (b == 4);
+ b = sll / a; VERIFY (b == -5);
+ b = ull / a; VERIFY (b == 10);
+ b = d32 / a; VERIFY (b == 1);
+ b = d64 / a; VERIFY (b == -2);
+ b = d128 / a; VERIFY (b == 5);
+}
+
+int
+main ()
+{
+ binary_add_32 ();
+ binary_subtract_32 ();
+ binary_multiply_32 ();
+ binary_divide_32 ();
+
+ binary_add_64 ();
+ binary_subtract_64 ();
+ binary_multiply_64 ();
+ binary_divide_64 ();
+
+ binary_add_128 ();
+ binary_subtract_128 ();
+ binary_multiply_128 ();
+ binary_divide_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/cast_neg.cc b/libstdc++-v3/testsuite/decimal/cast_neg.cc
new file mode 100644
index 0000000..7069fbb
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/cast_neg.cc
@@ -0,0 +1,62 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 doesn't say explicitly that the conversion from a
+// decimal floating-point type to a generic float type is prohibited but
+// it implies that in section 4.3 when it says "In C, objects of decimal
+// floating-oint type can be converted to generic floating-point type by
+// means of an explicit cast. In C++ this is not possible." Check that
+// attempt to do a cast are flagged as errors.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+float f;
+double d;
+long double ld;
+decimal32 d32;
+decimal64 d64;
+decimal128 d128;
+
+void
+foo (void)
+{
+ f = d32; // { dg-error "error" }
+ f = d64; // { dg-error "error" }
+ f = d128; // { dg-error "error" }
+ d = d32; // { dg-error "error" }
+ d = d64; // { dg-error "error" }
+ d = d128; // { dg-error "error" }
+ ld = d32; // { dg-error "error" }
+ ld = d64; // { dg-error "error" }
+ ld = d128; // { dg-error "error" }
+
+ f = (float)d32; // { dg-error "error" }
+ f = (float)d64; // { dg-error "error" }
+ f = (float)d128; // { dg-error "error" }
+ d = (double)d32; // { dg-error "error" }
+ d = (double)d64; // { dg-error "error" }
+ d = (double)d128; // { dg-error "error" }
+ ld = (long double)d32; // { dg-error "error" }
+ ld = (long double)d64; // { dg-error "error" }
+ ld = (long double)d128; // { dg-error "error" }
+}
diff --git a/libstdc++-v3/testsuite/decimal/comparison.cc b/libstdc++-v3/testsuite/decimal/comparison.cc
new file mode 100644
index 0000000..724938d
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/comparison.cc
@@ -0,0 +1,546 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.9 Comparison operators.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 d32 (5);
+decimal64 d64 (-10);
+decimal128 d128 (25);
+int si = -20;
+unsigned int ui = 50;
+long sl = -10;
+unsigned long ul = 20;
+long long sll = -25;
+unsigned long long ull = 50;
+
+void
+compare_eq_32 (void)
+{
+ decimal32 a;
+
+ a = si; VERIFY (a == si); VERIFY (si == a);
+ a = ui; VERIFY (a == ui); VERIFY (ui == a);
+ a = sl; VERIFY (a == sl); VERIFY (sl == a);
+ a = ul; VERIFY (a == ul); VERIFY (ul == a);
+ a = sll; VERIFY (a == sll); VERIFY (sll == a);
+ a = ull; VERIFY (a == ull); VERIFY (ull == a);
+ a = d32; VERIFY (a == d32); VERIFY (d32 == a);
+ a = (decimal32)d64; VERIFY (a == d64); VERIFY (d64 == a);
+ a = (decimal32)d128; VERIFY (a == d128); VERIFY (d128 == a);
+}
+
+void
+compare_ne_32 (void)
+{
+ decimal32 a = 100;
+
+ VERIFY (a != si); VERIFY (si != a);
+ VERIFY (a != ui); VERIFY (ui != a);
+ VERIFY (a != sl); VERIFY (sl != a);
+ VERIFY (a != ul); VERIFY (ul != a);
+ VERIFY (a != sll); VERIFY (sll != a);
+ VERIFY (a != ull); VERIFY (ull != a);
+ VERIFY (a != d32); VERIFY (d32 != a);
+ VERIFY (a != d64); VERIFY (d64 != a);
+ VERIFY (a != d128); VERIFY (d128 != a);
+}
+
+void
+compare_lt_32 (void)
+{
+ decimal32 a = -100;
+
+ VERIFY (a < si);
+ VERIFY (a < ui);
+ VERIFY (a < sl);
+ VERIFY (a < ul);
+ VERIFY (a < sll);
+ VERIFY (a < ull);
+ VERIFY (a < d32);
+ VERIFY (a < d64);
+ VERIFY (a < d128);
+
+ a = 100;
+ VERIFY (si < a);
+ VERIFY (ui < a);
+ VERIFY (sl < a);
+ VERIFY (ul < a);
+ VERIFY (sll < a);
+ VERIFY (ull < a);
+ VERIFY (d32 < a);
+ VERIFY (d64 < a);
+ VERIFY (d128 < a);
+}
+
+void
+compare_le_32 (void)
+{
+ decimal32 a;
+
+ a = si; VERIFY (a <= si); VERIFY (si <= a);
+ a = ui; VERIFY (a <= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a <= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a <= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a <= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a <= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a <= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a <= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a <= d128); VERIFY (d128 <= a);
+
+ a = -100;
+ VERIFY (a <= si);
+ VERIFY (a <= ui);
+ VERIFY (a <= sl);
+ VERIFY (a <= ul);
+ VERIFY (a <= sll);
+ VERIFY (a <= ull);
+ VERIFY (a <= d32);
+ VERIFY (a <= d64);
+ VERIFY (a <= d128);
+
+ a = 100;
+ VERIFY (si <= a);
+ VERIFY (ui <= a);
+ VERIFY (sl <= a);
+ VERIFY (ul <= a);
+ VERIFY (sll <= a);
+ VERIFY (ull <= a);
+ VERIFY (d32 <= a);
+ VERIFY (d64 <= a);
+ VERIFY (d128 <= a);
+}
+
+void
+compare_gt_32 (void)
+{
+ decimal32 a = 100;
+
+ VERIFY (a > si);
+ VERIFY (a > ui);
+ VERIFY (a > sl);
+ VERIFY (a > ul);
+ VERIFY (a > sll);
+ VERIFY (a > ull);
+ VERIFY (a > d32);
+ VERIFY (a > d64);
+ VERIFY (a > d128);
+
+ a = -100;
+ VERIFY (si > a);
+ VERIFY (ui > a);
+ VERIFY (sl > a);
+ VERIFY (ul > a);
+ VERIFY (sll > a);
+ VERIFY (ull > a);
+ VERIFY (d32 > a);
+ VERIFY (d64 > a);
+ VERIFY (d128 > a);
+}
+
+void
+compare_ge_32 (void)
+{
+ decimal32 a;
+
+ a = si; VERIFY (a >= si); VERIFY (si <= a);
+ a = ui; VERIFY (a >= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a >= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a >= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a >= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a >= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a >= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a >= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a >= d128); VERIFY (d128 <= a);
+
+ a = 100;
+ VERIFY (a >= si);
+ VERIFY (a >= ui);
+ VERIFY (a >= sl);
+ VERIFY (a >= ul);
+ VERIFY (a >= sll);
+ VERIFY (a >= ull);
+ VERIFY (a >= d32);
+ VERIFY (a >= d64);
+ VERIFY (a >= d128);
+
+ a = -100;
+ VERIFY (si >= a);
+ VERIFY (ui >= a);
+ VERIFY (sl >= a);
+ VERIFY (ul >= a);
+ VERIFY (sll >= a);
+ VERIFY (ull >= a);
+ VERIFY (d32 >= a);
+ VERIFY (d64 >= a);
+ VERIFY (d128 >= a);
+}
+
+void
+compare_eq_64 (void)
+{
+ decimal64 a;
+
+ a = si; VERIFY (a == si); VERIFY (si == a);
+ a = ui; VERIFY (a == ui); VERIFY (ui == a);
+ a = sl; VERIFY (a == sl); VERIFY (sl == a);
+ a = ul; VERIFY (a == ul); VERIFY (ul == a);
+ a = sll; VERIFY (a == sll); VERIFY (sll == a);
+ a = ull; VERIFY (a == ull); VERIFY (ull == a);
+ a = d32; VERIFY (a == d32); VERIFY (d32 == a);
+ a = d64; VERIFY (a == d64); VERIFY (d64 == a);
+ a = (decimal64)d128; VERIFY (a == d128); VERIFY (d128 == a);
+}
+
+void
+compare_ne_64 (void)
+{
+ decimal64 a = 100;
+
+ VERIFY (a != si); VERIFY (si != a);
+ VERIFY (a != ui); VERIFY (ui != a);
+ VERIFY (a != sl); VERIFY (sl != a);
+ VERIFY (a != ul); VERIFY (ul != a);
+ VERIFY (a != sll); VERIFY (sll != a);
+ VERIFY (a != ull); VERIFY (ull != a);
+ VERIFY (a != d32); VERIFY (d32 != a);
+ VERIFY (a != d64); VERIFY (d64 != a);
+ VERIFY (a != d128); VERIFY (d128 != a);
+}
+
+void
+compare_lt_64 (void)
+{
+ decimal64 a = -100;
+
+ VERIFY (a < si);
+ VERIFY (a < ui);
+ VERIFY (a < sl);
+ VERIFY (a < ul);
+ VERIFY (a < sll);
+ VERIFY (a < ull);
+ VERIFY (a < d32);
+ VERIFY (a < d64);
+ VERIFY (a < d128);
+
+ a = 100;
+ VERIFY (si < a);
+ VERIFY (ui < a);
+ VERIFY (sl < a);
+ VERIFY (ul < a);
+ VERIFY (sll < a);
+ VERIFY (ull < a);
+ VERIFY (d32 < a);
+ VERIFY (d64 < a);
+ VERIFY (d128 < a);
+}
+
+void
+compare_le_64 (void)
+{
+ decimal64 a;
+
+ a = si; VERIFY (a <= si); VERIFY (si <= a);
+ a = ui; VERIFY (a <= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a <= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a <= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a <= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a <= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a <= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a <= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a <= d128); VERIFY (d128 <= a);
+
+ a = -100;
+ VERIFY (a <= si);
+ VERIFY (a <= ui);
+ VERIFY (a <= sl);
+ VERIFY (a <= ul);
+ VERIFY (a <= sll);
+ VERIFY (a <= ull);
+ VERIFY (a <= d32);
+ VERIFY (a <= d64);
+ VERIFY (a <= d128);
+
+ a = 100;
+ VERIFY (si <= a);
+ VERIFY (ui <= a);
+ VERIFY (sl <= a);
+ VERIFY (ul <= a);
+ VERIFY (sll <= a);
+ VERIFY (ull <= a);
+ VERIFY (d32 <= a);
+ VERIFY (d64 <= a);
+ VERIFY (d128 <= a);
+}
+
+void
+compare_gt_64 (void)
+{
+ decimal64 a = 100;
+
+ VERIFY (a > si);
+ VERIFY (a > ui);
+ VERIFY (a > sl);
+ VERIFY (a > ul);
+ VERIFY (a > sll);
+ VERIFY (a > ull);
+ VERIFY (a > d32);
+ VERIFY (a > d64);
+ VERIFY (a > d128);
+
+ a = -100;
+ VERIFY (si > a);
+ VERIFY (ui > a);
+ VERIFY (sl > a);
+ VERIFY (ul > a);
+ VERIFY (sll > a);
+ VERIFY (ull > a);
+ VERIFY (d32 > a);
+ VERIFY (d64 > a);
+ VERIFY (d128 > a);
+}
+
+void
+compare_ge_64 (void)
+{
+ decimal64 a;
+
+ a = si; VERIFY (a >= si); VERIFY (si <= a);
+ a = ui; VERIFY (a >= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a >= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a >= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a >= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a >= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a >= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a >= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a >= d128); VERIFY (d128 <= a);
+
+ a = 100;
+ VERIFY (a >= si);
+ VERIFY (a >= ui);
+ VERIFY (a >= sl);
+ VERIFY (a >= ul);
+ VERIFY (a >= sll);
+ VERIFY (a >= ull);
+ VERIFY (a >= d32);
+ VERIFY (a >= d64);
+ VERIFY (a >= d128);
+
+ a = -100;
+ VERIFY (si >= a);
+ VERIFY (ui >= a);
+ VERIFY (sl >= a);
+ VERIFY (ul >= a);
+ VERIFY (sll >= a);
+ VERIFY (ull >= a);
+ VERIFY (d32 >= a);
+ VERIFY (d64 >= a);
+ VERIFY (d128 >= a);
+}
+
+void
+compare_eq_128 (void)
+{
+ decimal128 a;
+
+ a = si; VERIFY (a == si); VERIFY (si == a);
+ a = ui; VERIFY (a == ui); VERIFY (ui == a);
+ a = sl; VERIFY (a == sl); VERIFY (sl == a);
+ a = ul; VERIFY (a == ul); VERIFY (ul == a);
+ a = sll; VERIFY (a == sll); VERIFY (sll == a);
+ a = ull; VERIFY (a == ull); VERIFY (ull == a);
+ a = d32; VERIFY (a == d32); VERIFY (d32 == a);
+ a = d64; VERIFY (a == d64); VERIFY (d64 == a);
+ a = d128; VERIFY (a == d128); VERIFY (d128 == a);
+}
+
+void
+compare_ne_128 (void)
+{
+ decimal128 a = 100;
+
+ VERIFY (a != si); VERIFY (si != a);
+ VERIFY (a != ui); VERIFY (ui != a);
+ VERIFY (a != sl); VERIFY (sl != a);
+ VERIFY (a != ul); VERIFY (ul != a);
+ VERIFY (a != sll); VERIFY (sll != a);
+ VERIFY (a != ull); VERIFY (ull != a);
+ VERIFY (a != d32); VERIFY (d32 != a);
+ VERIFY (a != d64); VERIFY (d64 != a);
+ VERIFY (a != d128); VERIFY (d128 != a);
+}
+
+void
+compare_lt_128 (void)
+{
+ decimal128 a = -100;
+
+ VERIFY (a < si);
+ VERIFY (a < ui);
+ VERIFY (a < sl);
+ VERIFY (a < ul);
+ VERIFY (a < sll);
+ VERIFY (a < ull);
+ VERIFY (a < d32);
+ VERIFY (a < d64);
+ VERIFY (a < d128);
+
+ a = 100;
+ VERIFY (si < a);
+ VERIFY (ui < a);
+ VERIFY (sl < a);
+ VERIFY (ul < a);
+ VERIFY (sll < a);
+ VERIFY (ull < a);
+ VERIFY (d32 < a);
+ VERIFY (d64 < a);
+ VERIFY (d128 < a);
+}
+
+void
+compare_le_128 (void)
+{
+ decimal128 a;
+
+ a = si; VERIFY (a <= si); VERIFY (si <= a);
+ a = ui; VERIFY (a <= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a <= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a <= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a <= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a <= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a <= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a <= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a <= d128); VERIFY (d128 <= a);
+
+ a = -100;
+ VERIFY (a <= si);
+ VERIFY (a <= ui);
+ VERIFY (a <= sl);
+ VERIFY (a <= ul);
+ VERIFY (a <= sll);
+ VERIFY (a <= ull);
+ VERIFY (a <= d32);
+ VERIFY (a <= d64);
+ VERIFY (a <= d128);
+
+ a = 100;
+ VERIFY (si <= a);
+ VERIFY (ui <= a);
+ VERIFY (sl <= a);
+ VERIFY (ul <= a);
+ VERIFY (sll <= a);
+ VERIFY (ull <= a);
+ VERIFY (d32 <= a);
+ VERIFY (d64 <= a);
+ VERIFY (d128 <= a);
+}
+
+void
+compare_gt_128 (void)
+{
+ decimal128 a = 100;
+
+ VERIFY (a > si);
+ VERIFY (a > ui);
+ VERIFY (a > sl);
+ VERIFY (a > ul);
+ VERIFY (a > sll);
+ VERIFY (a > ull);
+ VERIFY (a > d32);
+ VERIFY (a > d64);
+ VERIFY (a > d128);
+
+ a = -100;
+ VERIFY (si > a);
+ VERIFY (ui > a);
+ VERIFY (sl > a);
+ VERIFY (ul > a);
+ VERIFY (sll > a);
+ VERIFY (ull > a);
+ VERIFY (d32 > a);
+ VERIFY (d64 > a);
+ VERIFY (d128 > a);
+}
+
+void
+compare_ge_128 (void)
+{
+ decimal128 a;
+
+ a = si; VERIFY (a >= si); VERIFY (si <= a);
+ a = ui; VERIFY (a >= ui); VERIFY (ui <= a);
+ a = sl; VERIFY (a >= sl); VERIFY (sl <= a);
+ a = ul; VERIFY (a >= ul); VERIFY (ul <= a);
+ a = sll; VERIFY (a >= sll); VERIFY (sll <= a);
+ a = ull; VERIFY (a >= ull); VERIFY (ull <= a);
+ a = d32; VERIFY (a >= d32); VERIFY (d32 <= a);
+ a = (decimal32)d64; VERIFY (a >= d64); VERIFY (d64 <= a);
+ a = (decimal32)d128; VERIFY (a >= d128); VERIFY (d128 <= a);
+
+ a = 100;
+ VERIFY (a >= si);
+ VERIFY (a >= ui);
+ VERIFY (a >= sl);
+ VERIFY (a >= ul);
+ VERIFY (a >= sll);
+ VERIFY (a >= ull);
+ VERIFY (a >= d32);
+ VERIFY (a >= d64);
+ VERIFY (a >= d128);
+
+ a = -100;
+ VERIFY (si >= a);
+ VERIFY (ui >= a);
+ VERIFY (sl >= a);
+ VERIFY (ul >= a);
+ VERIFY (sll >= a);
+ VERIFY (ull >= a);
+ VERIFY (d32 >= a);
+ VERIFY (d64 >= a);
+ VERIFY (d128 >= a);
+}
+
+int
+main ()
+{
+ compare_eq_32 ();
+ compare_ne_32 ();
+ compare_lt_32 ();
+ compare_le_32 ();
+ compare_gt_32 ();
+ compare_ge_32 ();
+
+ compare_eq_64 ();
+ compare_ne_64 ();
+ compare_lt_64 ();
+ compare_le_64 ();
+ compare_gt_64 ();
+ compare_ge_64 ();
+
+ compare_eq_128 ();
+ compare_ne_128 ();
+ compare_lt_128 ();
+ compare_le_128 ();
+ compare_gt_128 ();
+ compare_ge_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
new file mode 100644
index 0000000..dc38fb3
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment-memfunc.cc
@@ -0,0 +1,250 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.6 Compound assignment (decimal32).
+// ISO/IEC TR 24733 3.2.3.6 Compound assignment (decimal64).
+// ISO/IEC TR 24733 3.2.4.6 Compound assignment (decimal128).
+
+// Access member functions directly.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 d32 (5);
+decimal64 d64 (-10);
+decimal128 d128 (25);
+int si = -2;
+unsigned int ui = 5;
+long sl = -10;
+unsigned long ul = 20;
+long long sll = -25;
+unsigned long long ull = 50;
+
+void
+compound_assignment_add_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b.operator+=(d32); VERIFY (b == 1005);
+ b = a; b.operator+=(d64); VERIFY (b == 990);
+ b = a; b.operator+=(d128); VERIFY (b == 1025);
+ b = a; b.operator+=(si); VERIFY (b == 998);
+ b = a; b.operator+=(ui); VERIFY (b == 1005);
+ b = a; b.operator+=(sl); VERIFY (b == 990);
+ b = a; b.operator+=(ul); VERIFY (b == 1020);
+ b = a; b.operator+=(sll); VERIFY (b == 975);
+ b = a; b.operator+=(ull); VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b.operator-=(d32); VERIFY (b == 995);
+ b = a; b.operator-=(d64); VERIFY (b == 1010);
+ b = a; b.operator-=(d128); VERIFY (b == 975);
+ b = a; b.operator-=(si); VERIFY (b == 1002);
+ b = a; b.operator-=(ui); VERIFY (b == 995);
+ b = a; b.operator-=(sl); VERIFY (b == 1010);
+ b = a; b.operator-=(ul); VERIFY (b == 980);
+ b = a; b.operator-=(sll); VERIFY (b == 1025);
+ b = a; b.operator-=(ull); VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b.operator*=(d32); VERIFY (b == 5000);
+ b = a; b.operator*=(d64); VERIFY (b == -10000);
+ b = a; b.operator*=(d128); VERIFY (b == 25000);
+ b = a; b.operator*=(si); VERIFY (b == -2000);
+ b = a; b.operator*=(ui); VERIFY (b == 5000);
+ b = a; b.operator*=(sl); VERIFY (b == -10000);
+ b = a; b.operator*=(ul); VERIFY (b == 20000);
+ b = a; b.operator*=(sll); VERIFY (b == -25000);
+ b = a; b.operator*=(ull); VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b.operator/=(d32); VERIFY (b == 200);
+ b = a; b.operator/=(d64); VERIFY (b == -100);
+ b = a; b.operator/=(d128); VERIFY (b == 40);
+ b = a; b.operator/=(si); VERIFY (b == -500);
+ b = a; b.operator/=(ui); VERIFY (b == 200);
+ b = a; b.operator/=(sl); VERIFY (b == -100);
+ b = a; b.operator/=(ul); VERIFY (b == 50);
+ b = a; b.operator/=(sll); VERIFY (b == -40);
+ b = a; b.operator/=(ull); VERIFY (b == 20);
+}
+
+void
+compound_assignment_add_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b.operator+=(d32); VERIFY (b == 1005);
+ b = a; b.operator+=(d64); VERIFY (b == 990);
+ b = a; b.operator+=(d128); VERIFY (b == 1025);
+ b = a; b.operator+=(si); VERIFY (b == 998);
+ b = a; b.operator+=(ui); VERIFY (b == 1005);
+ b = a; b.operator+=(sl); VERIFY (b == 990);
+ b = a; b.operator+=(ul); VERIFY (b == 1020);
+ b = a; b.operator+=(sll); VERIFY (b == 975);
+ b = a; b.operator+=(ull); VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b.operator-=(d32); VERIFY (b == 995);
+ b = a; b.operator-=(d64); VERIFY (b == 1010);
+ b = a; b.operator-=(d128); VERIFY (b == 975);
+ b = a; b.operator-=(si); VERIFY (b == 1002);
+ b = a; b.operator-=(ui); VERIFY (b == 995);
+ b = a; b.operator-=(sl); VERIFY (b == 1010);
+ b = a; b.operator-=(ul); VERIFY (b == 980);
+ b = a; b.operator-=(sll); VERIFY (b == 1025);
+ b = a; b.operator-=(ull); VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b.operator*=(d32); VERIFY (b == 5000);
+ b = a; b.operator*=(d64); VERIFY (b == -10000);
+ b = a; b.operator*=(d128); VERIFY (b == 25000);
+ b = a; b.operator*=(si); VERIFY (b == -2000);
+ b = a; b.operator*=(ui); VERIFY (b == 5000);
+ b = a; b.operator*=(sl); VERIFY (b == -10000);
+ b = a; b.operator*=(ul); VERIFY (b == 20000);
+ b = a; b.operator*=(sll); VERIFY (b == -25000);
+ b = a; b.operator*=(ull); VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b.operator/=(d32); VERIFY (b == 200);
+ b = a; b.operator/=(d64); VERIFY (b == -100);
+ b = a; b.operator/=(d128); VERIFY (b == 40);
+ b = a; b.operator/=(si); VERIFY (b == -500);
+ b = a; b.operator/=(ui); VERIFY (b == 200);
+ b = a; b.operator/=(sl); VERIFY (b == -100);
+ b = a; b.operator/=(ul); VERIFY (b == 50);
+ b = a; b.operator/=(sll); VERIFY (b == -40);
+ b = a; b.operator/=(ull); VERIFY (b == 20);
+}
+
+void
+compound_assignment_add_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b.operator+=(d32); VERIFY (b == 1005);
+ b = a; b.operator+=(d64); VERIFY (b == 990);
+ b = a; b.operator+=(d128); VERIFY (b == 1025);
+ b = a; b.operator+=(si); VERIFY (b == 998);
+ b = a; b.operator+=(ui); VERIFY (b == 1005);
+ b = a; b.operator+=(sl); VERIFY (b == 990);
+ b = a; b.operator+=(ul); VERIFY (b == 1020);
+ b = a; b.operator+=(sll); VERIFY (b == 975);
+ b = a; b.operator+=(ull); VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b.operator-=(d32); VERIFY (b == 995);
+ b = a; b.operator-=(d64); VERIFY (b == 1010);
+ b = a; b.operator-=(d128); VERIFY (b == 975);
+ b = a; b.operator-=(si); VERIFY (b == 1002);
+ b = a; b.operator-=(ui); VERIFY (b == 995);
+ b = a; b.operator-=(sl); VERIFY (b == 1010);
+ b = a; b.operator-=(ul); VERIFY (b == 980);
+ b = a; b.operator-=(sll); VERIFY (b == 1025);
+ b = a; b.operator-=(ull); VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b.operator*=(d32); VERIFY (b == 5000);
+ b = a; b.operator*=(d64); VERIFY (b == -10000);
+ b = a; b.operator*=(d128); VERIFY (b == 25000);
+ b = a; b.operator*=(si); VERIFY (b == -2000);
+ b = a; b.operator*=(ui); VERIFY (b == 5000);
+ b = a; b.operator*=(sl); VERIFY (b == -10000);
+ b = a; b.operator*=(ul); VERIFY (b == 20000);
+ b = a; b.operator*=(sll); VERIFY (b == -25000);
+ b = a; b.operator*=(ull); VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b.operator/=(d32); VERIFY (b == 200);
+ b = a; b.operator/=(d64); VERIFY (b == -100);
+ b = a; b.operator/=(d128); VERIFY (b == 40);
+ b = a; b.operator/=(si); VERIFY (b == -500);
+ b = a; b.operator/=(ui); VERIFY (b == 200);
+ b = a; b.operator/=(sl); VERIFY (b == -100);
+ b = a; b.operator/=(ul); VERIFY (b == 50);
+ b = a; b.operator/=(sll); VERIFY (b == -40);
+ b = a; b.operator/=(ull); VERIFY (b == 20);
+}
+
+int
+main ()
+{
+ compound_assignment_add_32 ();
+ compound_assignment_subtract_32 ();
+ compound_assignment_multiply_32 ();
+ compound_assignment_divide_32 ();
+
+ compound_assignment_add_64 ();
+ compound_assignment_subtract_64 ();
+ compound_assignment_multiply_64 ();
+ compound_assignment_divide_64 ();
+
+ compound_assignment_add_128 ();
+ compound_assignment_subtract_128 ();
+ compound_assignment_multiply_128 ();
+ compound_assignment_divide_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/compound-assignment.cc b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
new file mode 100644
index 0000000..6d833e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/compound-assignment.cc
@@ -0,0 +1,248 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.6 Compound assignment (decimal32).
+// ISO/IEC TR 24733 3.2.3.6 Compound assignment (decimal64).
+// ISO/IEC TR 24733 3.2.4.6 Compound assignment (decimal128).
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 d32 (5);
+decimal64 d64 (-10);
+decimal128 d128 (25);
+int si = -2;
+unsigned int ui = 5;
+long sl = -10;
+unsigned long ul = 20;
+long long sll = -25;
+unsigned long long ull = 50;
+
+void
+compound_assignment_add_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b += d32; VERIFY (b == 1005);
+ b = a; b += d64; VERIFY (b == 990);
+ b = a; b += d128; VERIFY (b == 1025);
+ b = a; b += si; VERIFY (b == 998);
+ b = a; b += ui; VERIFY (b == 1005);
+ b = a; b += sl; VERIFY (b == 990);
+ b = a; b += ul; VERIFY (b == 1020);
+ b = a; b += sll; VERIFY (b == 975);
+ b = a; b += ull; VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b -= d32; VERIFY (b == 995);
+ b = a; b -= d64; VERIFY (b == 1010);
+ b = a; b -= d128; VERIFY (b == 975);
+ b = a; b -= si; VERIFY (b == 1002);
+ b = a; b -= ui; VERIFY (b == 995);
+ b = a; b -= sl; VERIFY (b == 1010);
+ b = a; b -= ul; VERIFY (b == 980);
+ b = a; b -= sll; VERIFY (b == 1025);
+ b = a; b -= ull; VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b *= d32; VERIFY (b == 5000);
+ b = a; b *= d64; VERIFY (b == -10000);
+ b = a; b *= d128; VERIFY (b == 25000);
+ b = a; b *= si; VERIFY (b == -2000);
+ b = a; b *= ui; VERIFY (b == 5000);
+ b = a; b *= sl; VERIFY (b == -10000);
+ b = a; b *= ul; VERIFY (b == 20000);
+ b = a; b *= sll; VERIFY (b == -25000);
+ b = a; b *= ull; VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_32 (void)
+{
+ decimal32 a (1000), b;
+
+ b = a; b /= d32; VERIFY (b == 200);
+ b = a; b /= d64; VERIFY (b == -100);
+ b = a; b /= d128; VERIFY (b == 40);
+ b = a; b /= si; VERIFY (b == -500);
+ b = a; b /= ui; VERIFY (b == 200);
+ b = a; b /= sl; VERIFY (b == -100);
+ b = a; b /= ul; VERIFY (b == 50);
+ b = a; b /= sll; VERIFY (b == -40);
+ b = a; b /= ull; VERIFY (b == 20);
+}
+
+void
+compound_assignment_add_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b += d32; VERIFY (b == 1005);
+ b = a; b += d64; VERIFY (b == 990);
+ b = a; b += d128; VERIFY (b == 1025);
+ b = a; b += si; VERIFY (b == 998);
+ b = a; b += ui; VERIFY (b == 1005);
+ b = a; b += sl; VERIFY (b == 990);
+ b = a; b += ul; VERIFY (b == 1020);
+ b = a; b += sll; VERIFY (b == 975);
+ b = a; b += ull; VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b -= d32; VERIFY (b == 995);
+ b = a; b -= d64; VERIFY (b == 1010);
+ b = a; b -= d128; VERIFY (b == 975);
+ b = a; b -= si; VERIFY (b == 1002);
+ b = a; b -= ui; VERIFY (b == 995);
+ b = a; b -= sl; VERIFY (b == 1010);
+ b = a; b -= ul; VERIFY (b == 980);
+ b = a; b -= sll; VERIFY (b == 1025);
+ b = a; b -= ull; VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b *= d32; VERIFY (b == 5000);
+ b = a; b *= d64; VERIFY (b == -10000);
+ b = a; b *= d128; VERIFY (b == 25000);
+ b = a; b *= si; VERIFY (b == -2000);
+ b = a; b *= ui; VERIFY (b == 5000);
+ b = a; b *= sl; VERIFY (b == -10000);
+ b = a; b *= ul; VERIFY (b == 20000);
+ b = a; b *= sll; VERIFY (b == -25000);
+ b = a; b *= ull; VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_64 (void)
+{
+ decimal64 a (1000), b;
+
+ b = a; b /= d32; VERIFY (b == 200);
+ b = a; b /= d64; VERIFY (b == -100);
+ b = a; b /= d128; VERIFY (b == 40);
+ b = a; b /= si; VERIFY (b == -500);
+ b = a; b /= ui; VERIFY (b == 200);
+ b = a; b /= sl; VERIFY (b == -100);
+ b = a; b /= ul; VERIFY (b == 50);
+ b = a; b /= sll; VERIFY (b == -40);
+ b = a; b /= ull; VERIFY (b == 20);
+}
+
+void
+compound_assignment_add_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b += d32; VERIFY (b == 1005);
+ b = a; b += d64; VERIFY (b == 990);
+ b = a; b += d128; VERIFY (b == 1025);
+ b = a; b += si; VERIFY (b == 998);
+ b = a; b += ui; VERIFY (b == 1005);
+ b = a; b += sl; VERIFY (b == 990);
+ b = a; b += ul; VERIFY (b == 1020);
+ b = a; b += sll; VERIFY (b == 975);
+ b = a; b += ull; VERIFY (b == 1050);
+}
+
+void
+compound_assignment_subtract_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b -= d32; VERIFY (b == 995);
+ b = a; b -= d64; VERIFY (b == 1010);
+ b = a; b -= d128; VERIFY (b == 975);
+ b = a; b -= si; VERIFY (b == 1002);
+ b = a; b -= ui; VERIFY (b == 995);
+ b = a; b -= sl; VERIFY (b == 1010);
+ b = a; b -= ul; VERIFY (b == 980);
+ b = a; b -= sll; VERIFY (b == 1025);
+ b = a; b -= ull; VERIFY (b == 950);
+}
+
+void
+compound_assignment_multiply_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b *= d32; VERIFY (b == 5000);
+ b = a; b *= d64; VERIFY (b == -10000);
+ b = a; b *= d128; VERIFY (b == 25000);
+ b = a; b *= si; VERIFY (b == -2000);
+ b = a; b *= ui; VERIFY (b == 5000);
+ b = a; b *= sl; VERIFY (b == -10000);
+ b = a; b *= ul; VERIFY (b == 20000);
+ b = a; b *= sll; VERIFY (b == -25000);
+ b = a; b *= ull; VERIFY (b == 50000);
+}
+
+void
+compound_assignment_divide_128 (void)
+{
+ decimal128 a (1000), b;
+
+ b = a; b /= d32; VERIFY (b == 200);
+ b = a; b /= d64; VERIFY (b == -100);
+ b = a; b /= d128; VERIFY (b == 40);
+ b = a; b /= si; VERIFY (b == -500);
+ b = a; b /= ui; VERIFY (b == 200);
+ b = a; b /= sl; VERIFY (b == -100);
+ b = a; b /= ul; VERIFY (b == 50);
+ b = a; b /= sll; VERIFY (b == -40);
+ b = a; b /= ull; VERIFY (b == 20);
+}
+
+int
+main ()
+{
+ compound_assignment_add_32 ();
+ compound_assignment_subtract_32 ();
+ compound_assignment_multiply_32 ();
+ compound_assignment_divide_32 ();
+
+ compound_assignment_add_64 ();
+ compound_assignment_subtract_64 ();
+ compound_assignment_multiply_64 ();
+ compound_assignment_divide_64 ();
+
+ compound_assignment_add_128 ();
+ compound_assignment_subtract_128 ();
+ compound_assignment_multiply_128 ();
+ compound_assignment_divide_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/conversion-from-float.cc b/libstdc++-v3/testsuite/decimal/conversion-from-float.cc
new file mode 100644
index 0000000..9c5197d
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/conversion-from-float.cc
@@ -0,0 +1,101 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.2 Conversion from floating-point type (decimal32).
+// ISO/IEC TR 24733 3.2.3.2 Conversion from floating-point type (decimal64).
+// ISO/IEC TR 24733 3.2.4.2 Conversion from floating-point type (decimal128).
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+void
+conversion_from_float_32 ()
+{
+ decimal32 d32(123);
+ decimal64 d64(234);
+ decimal128 d128(345);
+ float f = 456.F;
+ double d = 567.;
+ long double ld = 678.L;
+
+ d32 = (decimal32) d64;
+ VERIFY (d32 == make_decimal32 (234LL, 0));
+ d32 = (decimal32) d128;
+ VERIFY (d32 == make_decimal32 (345LL, 0));
+ d32 = (decimal32) f;
+ VERIFY (d32 == make_decimal32 (456LL, 0));
+ d32 = (decimal32) d;
+ VERIFY (d32 == make_decimal32 (567LL, 0));
+ d32 = (decimal32) ld;
+ VERIFY (d32 == make_decimal32 (678LL, 0));
+}
+
+void
+conversion_from_float_64 ()
+{
+ decimal32 d32(123);
+ decimal64 d64(234);
+ decimal128 d128(345);
+ float f = 456.F;
+ double d = 567.;
+ long double ld = 678.L;
+
+ d64 = d32;
+ VERIFY (d64 == make_decimal64 (123LL, 0));
+ d64 = (decimal64) d128;
+ VERIFY (d64 == make_decimal64 (345LL, 0));
+ d64 = (decimal64) f;
+ VERIFY (d64 == make_decimal64 (456LL, 0));
+ d64 = (decimal64) d;
+ VERIFY (d64 == make_decimal64 (567LL, 0));
+ d64 = (decimal64) ld;
+ VERIFY (d64 == make_decimal64 (678LL, 0));
+}
+
+void
+conversion_from_float_128 ()
+{
+ decimal32 d32(123);
+ decimal64 d64(234);
+ decimal128 d128(345);
+ float f = 456.F;
+ double d = 567.;
+ long double ld = 678.L;
+
+ d128 = d32;
+ VERIFY (d128 == make_decimal128 (123LL, 0));
+ d128 = d64;
+ VERIFY (d128 == make_decimal128 (234LL, 0));
+ d128 = (decimal128) f;
+ VERIFY (d128 == make_decimal128 (456LL, 0));
+ d128 = (decimal128) d;
+ VERIFY (d128 == make_decimal128 (567LL, 0));
+ d128 = (decimal128) ld;
+ VERIFY (d128 == make_decimal128 (678LL, 0));
+}
+
+int
+main ()
+{
+ conversion_from_float_32 ();
+ conversion_from_float_64 ();
+ conversion_from_float_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/conversion-from-integral.cc b/libstdc++-v3/testsuite/decimal/conversion-from-integral.cc
new file mode 100644
index 0000000..5ba1806
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/conversion-from-integral.cc
@@ -0,0 +1,193 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.3 Conversion from integral type (decimal32).
+// ISO/IEC TR 24733 3.2.3.3 Conversion from integral type (decimal64).
+// ISO/IEC TR 24733 3.2.4.3 Conversion from integral type (decimal128).
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+void
+conversion_from_integral_p32 ()
+{
+ decimal32 d;
+ decimal32 from_si (1);
+ decimal32 from_ui (2U);
+ decimal32 from_sl (3L);
+ decimal32 from_ul (4UL);
+ decimal32 from_sll (5LL);
+ decimal32 from_ull (6ULL);
+
+ d++; VERIFY (from_si == d);
+ d++; VERIFY (from_ui == d);
+ d++; VERIFY (from_sl == d);
+ d++; VERIFY (from_ul == d);
+ d++; VERIFY (from_sll == d);
+ d++; VERIFY (from_ull == d);
+
+ from_si = 7;
+ d++; VERIFY (from_si == d);
+ from_ui = 8U;
+ d++; VERIFY (from_ui == d);
+ from_sl = 9L;
+ d++; VERIFY (from_sl == d);
+ from_ul = 10UL;
+ d++; VERIFY (from_ul == d);
+ from_sll = 11LL;
+ d++; VERIFY (from_sll == d);
+ from_ull = 12ULL;
+ d++; VERIFY (from_ull == d);
+}
+
+void
+conversion_from_integral_m32 ()
+{
+ decimal32 d;
+ decimal32 from_si (-1);
+ decimal32 from_sl (-2L);
+ decimal32 from_sll (-3LL);
+
+ d--; VERIFY (from_si == d);
+ d--; VERIFY (from_sl == d);
+ d--; VERIFY (from_sll == d);
+
+ from_si = -4;
+ d--; VERIFY (from_si == d);
+ from_sl = -5L;
+ d--; VERIFY (from_sl == d);
+ from_sll = -6LL;
+ d--; VERIFY (from_sll == d);
+}
+
+void
+conversion_from_integral_p64 ()
+{
+ decimal64 d;
+ decimal64 from_si (1);
+ decimal64 from_ui (2U);
+ decimal64 from_sl (3L);
+ decimal64 from_ul (4UL);
+ decimal64 from_sll (5LL);
+ decimal64 from_ull (6ULL);
+
+ d++; VERIFY (from_si == d);
+ d++; VERIFY (from_ui == d);
+ d++; VERIFY (from_sl == d);
+ d++; VERIFY (from_ul == d);
+ d++; VERIFY (from_sll == d);
+ d++; VERIFY (from_ull == d);
+
+ from_si = 7;
+ d++; VERIFY (from_si == d);
+ from_ui = 8U;
+ d++; VERIFY (from_ui == d);
+ from_sl = 9L;
+ d++; VERIFY (from_sl == d);
+ from_ul = 10UL;
+ d++; VERIFY (from_ul == d);
+ from_sll = 11LL;
+ d++; VERIFY (from_sll == d);
+ from_ull = 12ULL;
+ d++; VERIFY (from_ull == d);
+}
+
+void
+conversion_from_integral_m64 ()
+{
+ decimal64 d;
+ decimal64 from_si (-1);
+ decimal64 from_sl (-2L);
+ decimal64 from_sll (-3LL);
+
+ d--; VERIFY (from_si == d);
+ d--; VERIFY (from_sl == d);
+ d--; VERIFY (from_sll == d);
+
+ from_si = -4;
+ d--; VERIFY (from_si == d);
+ from_sl = -5L;
+ d--; VERIFY (from_sl == d);
+ from_sll = -6LL;
+ d--; VERIFY (from_sll == d);
+}
+
+void
+conversion_from_integral_p128 ()
+{
+ decimal128 d;
+ decimal128 from_si (1);
+ decimal128 from_ui (2U);
+ decimal128 from_sl (3L);
+ decimal128 from_ul (4UL);
+ decimal128 from_sll (5LL);
+ decimal128 from_ull (6ULL);
+
+ d++; VERIFY (from_si == d);
+ d++; VERIFY (from_ui == d);
+ d++; VERIFY (from_sl == d);
+ d++; VERIFY (from_ul == d);
+ d++; VERIFY (from_sll == d);
+ d++; VERIFY (from_ull == d);
+
+ from_si = 7;
+ d++; VERIFY (from_si == d);
+ from_ui = 8U;
+ d++; VERIFY (from_ui == d);
+ from_sl = 9L;
+ d++; VERIFY (from_sl == d);
+ from_ul = 10UL;
+ d++; VERIFY (from_ul == d);
+ from_sll = 11LL;
+ d++; VERIFY (from_sll == d);
+ from_ull = 12ULL;
+}
+
+void
+conversion_from_integral_m128 ()
+{
+ decimal128 d;
+ decimal128 from_si (-1);
+ decimal128 from_sl (-2L);
+ decimal128 from_sll (-3LL);
+
+ d--; VERIFY (from_si == d);
+ d--; VERIFY (from_sl == d);
+ d--; VERIFY (from_sll == d);
+
+ from_si = -4;
+ d--; VERIFY (from_si == d);
+ from_sl = -5L;
+ d--; VERIFY (from_sl == d);
+ from_sll = -6LL;
+ d--; VERIFY (from_sll == d);
+}
+
+int
+main ()
+{
+ conversion_from_integral_p32 ();
+ conversion_from_integral_m32 ();
+ conversion_from_integral_p64 ();
+ conversion_from_integral_m64 ();
+ conversion_from_integral_p128 ();
+ conversion_from_integral_m128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/conversion-to-generic-float.cc b/libstdc++-v3/testsuite/decimal/conversion-to-generic-float.cc
new file mode 100644
index 0000000..9a9e335
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/conversion-to-generic-float.cc
@@ -0,0 +1,105 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+void
+conversion_to_generic_float_32 ()
+{
+ std::decimal::decimal32 d32(123);
+ float f;
+ double d;
+ long double ld;
+
+ f = decimal32_to_float (d32);
+ VERIFY (f == 123.F);
+ d = decimal32_to_double (d32);
+ VERIFY (d == 123.);
+ ld = decimal32_to_long_double (d32);
+ VERIFY (ld == 123.L);
+
+ d32++;
+ f = decimal_to_float (d32);
+ VERIFY (f == 124.F);
+ d = decimal_to_double (d32);
+ VERIFY (d == 124.);
+ ld = decimal_to_long_double (d32);
+ VERIFY (ld == 124.L);
+}
+
+void
+conversion_to_generic_float_64 ()
+{
+ std::decimal::decimal64 d64(234);
+ float f;
+ double d;
+ long double ld;
+
+ f = decimal64_to_float (d64);
+ VERIFY (f == 234.F);
+ d = decimal64_to_double (d64);
+ VERIFY (d == 234.);
+ ld = decimal64_to_long_double (d64);
+ VERIFY (ld == 234.L);
+
+ d64++;
+ f = decimal_to_float (d64);
+ VERIFY (f == 235.F);
+ d = decimal_to_double (d64);
+ VERIFY (d == 235.);
+ ld = decimal_to_long_double (d64);
+ VERIFY (ld == 235.L);
+}
+
+void
+conversion_to_generic_float_128 ()
+{
+ std::decimal::decimal128 d128(345);
+ float f;
+ double d;
+ long double ld;
+
+ f = decimal128_to_float (d128);
+ VERIFY (f == 345.F);
+ d = decimal128_to_double (d128);
+ VERIFY (d == 345.);
+ ld = decimal128_to_long_double (d128);
+ VERIFY (ld == 345.L);
+
+ d128++;
+ f = decimal_to_float (d128);
+ VERIFY (f == 346.F);
+ d = decimal_to_double (d128);
+ VERIFY (d == 346.);
+ ld = decimal_to_long_double (d128);
+ VERIFY (ld == 346.L);
+}
+
+int
+main ()
+{
+ conversion_to_generic_float_32 ();
+ conversion_to_generic_float_64 ();
+ conversion_to_generic_float_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/conversion-to-integral.cc b/libstdc++-v3/testsuite/decimal/conversion-to-integral.cc
new file mode 100644
index 0000000..36c5485
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/conversion-to-integral.cc
@@ -0,0 +1,85 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.4 Conversion to integral type (decimal32).
+// ISO/IEC TR 24733 3.2.3.4 Conversion to integral type (decimal64).
+// ISO/IEC TR 24733 3.2.4.4 Conversion to integral type (decimal128).
+
+#include <decimal/decimal>
+#include <climits>
+#include <cstdio>
+#include <testsuite_hooks.h>
+
+// Use extension to replace implicit long long conversion with function call.
+#define LONGLONG(X) decimal_to_long_long(X)
+
+using namespace std::decimal;
+
+void
+conversion_to_integral_32 (void)
+{
+ #undef MAXVAL
+ #define MAXVAL 999999LL
+ decimal32 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
+ long long ll;
+
+ ll = LONGLONG (a); VERIFY (ll == 0LL);
+ ll = LONGLONG (b); VERIFY (ll == 1LL);
+ ll = LONGLONG (c); VERIFY (ll == -1LL);
+ ll = LONGLONG (d); VERIFY (ll == MAXVAL);
+ ll = LONGLONG (e); VERIFY (ll == -MAXVAL);
+}
+
+void
+conversion_to_integral_64 (void)
+{
+ #undef MAXVAL
+ #define MAXVAL 999999999999999LL
+ decimal64 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
+ long long ll;
+
+ ll = LONGLONG (a); VERIFY (ll == 0LL);
+ ll = LONGLONG (b); VERIFY (ll == 1LL);
+ ll = LONGLONG (c); VERIFY (ll == -1LL);
+ ll = LONGLONG (d); VERIFY (ll == MAXVAL);
+ ll = LONGLONG (e); VERIFY (ll == -MAXVAL);
+}
+
+void
+conversion_to_integral_128 (void)
+{
+ #undef MAXVAL
+ #define MAXVAL LONG_LONG_MAX
+ decimal128 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
+ long long ll;
+
+ ll = LONGLONG (a); VERIFY (ll == 0LL);
+ ll = LONGLONG (b); VERIFY (ll == 1LL);
+ ll = LONGLONG (c); VERIFY (ll == -1LL);
+ ll = LONGLONG (d); VERIFY (ll == MAXVAL);
+ ll = LONGLONG (e); VERIFY (ll == -MAXVAL);
+}
+
+int
+main ()
+{
+ conversion_to_integral_32 ();
+ conversion_to_integral_64 ();
+ conversion_to_integral_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/ctor.cc b/libstdc++-v3/testsuite/decimal/ctor.cc
new file mode 100644
index 0000000..378741b
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/ctor.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.1 Construct/copy/destroy (decimal32).
+// ISO/IEC TR 24733 3.2.3.1 Construct/copy/destroy (decimal64).
+// ISO/IEC TR 24733 3.2.4.1 Construct/copy/destroy (decimal128).
+
+// Test the default constructor.
+
+#include <decimal/decimal>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+void
+ctor_32 (void)
+{
+ decimal32 a;
+ float b __attribute__((mode(SD))) = 0.e-101DF;
+
+ VERIFY (memcmp (&a, &b, 4) == 0);
+}
+
+void
+ctor_64 (void)
+{
+ decimal64 a;
+ float b __attribute__((mode(DD))) = 0.e-398DD;
+
+ VERIFY (memcmp (&a, &b, 8) == 0);
+}
+
+void
+ctor_128 (void)
+{
+ decimal128 a;
+ float b __attribute__((mode(TD))) = 0.e-6176DL;
+
+ VERIFY (memcmp (&a, &b, 16) == 0);
+}
+
+int
+main ()
+{
+ ctor_32 ();
+ ctor_64 ();
+ ctor_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/incdec-memfunc.cc b/libstdc++-v3/testsuite/decimal/incdec-memfunc.cc
new file mode 100644
index 0000000..690224d
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/incdec-memfunc.cc
@@ -0,0 +1,181 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.5 Increment and decrement operators (decimal32).
+// ISO/IEC TR 24733 3.2.3.5 Increment and decrement operators (decimal64).
+// ISO/IEC TR 24733 3.2.4.5 Increment and decrement operators (decimal128).
+
+// Access member functions directly.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+// Use extension to replace implicit long long conversion with function call.
+#define LONGLONG(X) decimal_to_long_long(X)
+
+using namespace std::decimal;
+
+void
+incdec32 (void)
+{
+ int ival;
+ std::decimal::decimal32 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ b.operator++();
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator++(1);
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator--();
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b.operator--(1);
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = b.operator++();
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b.operator++(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = b.operator--();
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b.operator--(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+void
+incdec64 (void)
+{
+ int ival;
+ std::decimal::decimal64 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ b.operator++();
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator++(1);
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator--();
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b.operator--(1);
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = b.operator++();
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b.operator++(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = b.operator--();
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b.operator--(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+void
+incdec128 (void)
+{
+ int ival;
+ std::decimal::decimal128 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ b.operator++();
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator++(1);
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b.operator--();
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b.operator--(1);
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = b.operator++();
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b.operator++(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = b.operator--();
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b.operator--(1);
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+int
+main ()
+{
+ incdec32 ();
+ incdec64 ();
+ incdec128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/incdec.cc b/libstdc++-v3/testsuite/decimal/incdec.cc
new file mode 100644
index 0000000..6286395
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/incdec.cc
@@ -0,0 +1,179 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.2.5 Increment and decrement operators (decimal32).
+// ISO/IEC TR 24733 3.2.3.5 Increment and decrement operators (decimal64).
+// ISO/IEC TR 24733 3.2.4.5 Increment and decrement operators (decimal128).
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+// Use extension to replace implicit long long conversion with function call.
+#define LONGLONG(X) decimal_to_long_long(X)
+
+using namespace std::decimal;
+
+void
+incdec32 (void)
+{
+ int ival;
+ std::decimal::decimal32 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ ++b;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b++;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ --b;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b--;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = ++b;
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b++;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = --b;
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b--;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+void
+incdec64 (void)
+{
+ int ival;
+ std::decimal::decimal64 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ ++b;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b++;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ --b;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b--;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = ++b;
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b++;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = --b;
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b--;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+void
+incdec128 (void)
+{
+ int ival;
+ std::decimal::decimal128 a(11), b, c;
+
+ // Verify that we get the expected value of b after assignment.
+ b = a;
+ ival = LONGLONG (b); VERIFY (ival == 11);
+
+ // Check that the increment and decrement operators change the value
+ // of the original class.
+ b = a;
+ ++b;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ b++;
+ ival = LONGLONG (b); VERIFY (ival == 12);
+
+ b = a;
+ --b;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ b = a;
+ b--;
+ ival = LONGLONG (b); VERIFY (ival == 10);
+
+ // Check that the increment and decrement operators return the
+ // correct value.
+ b = a;
+ c = ++b;
+ ival = LONGLONG (c); VERIFY (ival == 12);
+
+ b = a;
+ c = b++;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+
+ b = a;
+ c = --b;
+ ival = LONGLONG (c); VERIFY (ival == 10);
+
+ b = a;
+ c = b--;
+ ival = LONGLONG (c); VERIFY (ival == 11);
+}
+
+int
+main ()
+{
+ incdec32 ();
+ incdec64 ();
+ incdec128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/make-decimal.cc b/libstdc++-v3/testsuite/decimal/make-decimal.cc
new file mode 100644
index 0000000..7be1c7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/make-decimal.cc
@@ -0,0 +1,132 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent.
+
+#include <decimal/decimal>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+#define PASTE2(A,B) A ## B
+#define PASTE(A,B) PASTE2(A,B)
+
+#define TESTVAL_NEG(COEFF,ESIGN,EXP,SUF,NUM,SIZE) \
+ x = PASTE(PASTE(PASTE(PASTE(PASTE(COEFF,.),E),ESIGN),EXP),SUF); \
+ sll = PASTE(COEFF,LL); \
+ i = ESIGN EXP; \
+ a = PASTE(make_decimal,32) (sll, i); \
+ b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \
+ VERIFY ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) == 0) \
+ && (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) == 0));
+
+#define TESTVAL_NONNEG(COEFF,ESIGN,EXP,SUF,NUM,SIZE) \
+ x = PASTE(PASTE(PASTE(PASTE(PASTE(COEFF,.),E),ESIGN),EXP),SUF); \
+ sll = PASTE(COEFF,LL); \
+ ull = PASTE(COEFF,ULL); \
+ i = ESIGN EXP; \
+ a = PASTE(make_decimal,32) (sll, i); \
+ b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \
+ c = PASTE(make_decimal,32) (ull, i); \
+ d = PASTE(make_decimal,32) (PASTE(COEFF,ULL), ESIGN EXP); \
+ VERIFY ((__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));
+
+using namespace std::decimal;
+
+void
+make_decimal_32 (void)
+{
+ decimal32 a, b, c, d;
+ float x __attribute__((mode(SD)));
+ int i;
+ unsigned long sz = sizeof (decimal32);
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, +, 0, DF, 32, sz);
+ TESTVAL_NONNEG (5, +, 1, DF, 32, sz);
+ TESTVAL_NONNEG (50, +, 0, DF, 32, sz);
+ TESTVAL_NONNEG (500, +, 0, DF, 32, sz);
+ TESTVAL_NEG (-25, -, 3, DF, 32, sz)
+ TESTVAL_NEG (-500, +, 0, DF, 32, sz);
+ TESTVAL_NONNEG (999999, +, 91, DF, 32, sz);
+ TESTVAL_NONNEG (1, -, 9, DF, 32, sz);
+ TESTVAL_NONNEG (1, -, 90, DF, 32, sz);
+ TESTVAL_NONNEG (1, -, 95, DF, 32, sz);
+ TESTVAL_NONNEG (1, -, 101, DF, 32, sz);
+ TESTVAL_NEG (-1, -, 101, DF, 32, sz);
+}
+
+void
+make_decimal_64 (void)
+{
+ decimal64 a, b, c, d;
+ float x __attribute__((mode(DD)));
+ int i;
+ unsigned long sz = sizeof (decimal64);
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, +, 0, DF, 64, sz);
+ TESTVAL_NONNEG (5, +, 1, DF, 64, sz);
+ TESTVAL_NONNEG (50, +, 0, DF, 64, sz);
+ TESTVAL_NONNEG (500, +, 0, DF, 64, sz);
+ TESTVAL_NEG (-25, -, 3, DF, 64, sz)
+ TESTVAL_NEG (-500, +, 0, DF, 64, sz);
+ TESTVAL_NONNEG (999999, +, 91, DF, 64, sz);
+ TESTVAL_NONNEG (1, -, 9, DF, 64, sz);
+ TESTVAL_NONNEG (1, -, 90, DF, 64, sz);
+ TESTVAL_NONNEG (1, -, 95, DF, 64, sz);
+ TESTVAL_NONNEG (1, -, 101, DF, 64, sz);
+ TESTVAL_NEG (-1, -, 101, DF, 64, sz);
+}
+
+void
+make_decimal_128 (void)
+{
+ decimal128 a, b, c, d;
+ float x __attribute__((mode(TD)));
+ int i;
+ unsigned long sz = sizeof (decimal128);
+ volatile long long sll;
+ volatile unsigned long long ull;
+
+ TESTVAL_NONNEG (0, +, 0, DF, 128, sz);
+ TESTVAL_NONNEG (5, +, 1, DF, 128, sz);
+ TESTVAL_NONNEG (50, +, 0, DF, 128, sz);
+ TESTVAL_NONNEG (500, +, 0, DF, 128, sz);
+ TESTVAL_NEG (-25, -, 3, DF, 128, sz)
+ TESTVAL_NEG (-500, +, 0, DF, 128, sz);
+ TESTVAL_NONNEG (999999, +, 91, DF, 128, sz);
+ TESTVAL_NONNEG (1, -, 9, DF, 128, sz);
+ TESTVAL_NONNEG (1, -, 90, DF, 128, sz);
+ TESTVAL_NONNEG (1, -, 95, DF, 128, sz);
+ TESTVAL_NONNEG (1, -, 101, DF, 128, sz);
+ TESTVAL_NEG (-1, -, 101, DF, 128, sz);
+}
+
+int
+main ()
+{
+ make_decimal_32 ();
+ make_decimal_64 ();
+ make_decimal_128 ();
+}
diff --git a/libstdc++-v3/testsuite/decimal/mixed-mode_neg.cc b/libstdc++-v3/testsuite/decimal/mixed-mode_neg.cc
new file mode 100644
index 0000000..3cf3f7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/mixed-mode_neg.cc
@@ -0,0 +1,206 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-require-effective-target-dfp }
+
+// Test that binary operators do not accept mixed decimal and generic
+// floating-point operands. This isn't explicity prohibited in
+// ISO/IEC TR 24733 but it is prohibited in C, and in C++ there should
+// not be an implicit conversion from a decimal floating-point type to
+// a generic floating-point type.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 a32, b32, c32;
+decimal64 a64, b64, c64;
+decimal128 a128, b128, c128;
+float f;
+double d;
+long double ld;
+bool b1, b2, b3, b4, b5, b6;
+
+void
+bad_add (void)
+{
+ a32 = b32 + f; // { dg-error "error" }
+ a32 = ld + b32; // { dg-error "error" }
+ a64 = b64 + d; // { dg-error "error" }
+ a64 = ld + b64; // { dg-error "error" }
+ a128 = b128 + ld; // { dg-error "error" }
+ a128 = d + b128; // { dg-error "error" }
+}
+
+void
+bad_subtract (void)
+{
+ a32 = b32 - f; // { dg-error "error" }
+ a32 = ld - b32; // { dg-error "error" }
+ a64 = b64 - d; // { dg-error "error" }
+ a64 = ld - b64; // { dg-error "error" }
+ a128 = b128 - ld; // { dg-error "error" }
+ a128 = d - b128; // { dg-error "error" }
+}
+
+void
+bad_multiply (void)
+{
+ a32 = b32 * f; // { dg-error "error" }
+ a32 = ld * b32; // { dg-error "error" }
+ a64 = b64 * d; // { dg-error "error" }
+ a64 = ld * b64; // { dg-error "error" }
+ a128 = b128 * ld; // { dg-error "error" }
+ a128 = d * b128; // { dg-error "error" }
+}
+
+void
+bad_divide (void)
+{
+ a32 = b32 / f; // { dg-error "error" }
+ a32 = ld / b32; // { dg-error "error" }
+ a64 = b64 / d; // { dg-error "error" }
+ a64 = ld / b64; // { dg-error "error" }
+ a128 = b128 / ld; // { dg-error "error" }
+ a128 = d / b128; // { dg-error "error" }
+}
+
+void
+bad_eq (void)
+{
+ b1 = b32 == f; // { dg-error "error" }
+ b2 = ld == b32; // { dg-error "error" }
+ b3 = b64 == d; // { dg-error "error" }
+ b4 = ld == b64; // { dg-error "error" }
+ b5 = b128 == ld; // { dg-error "error" }
+ b6 = d == b128; // { dg-error "error" }
+}
+
+void
+bad_ne (void)
+{
+ b1 = b32 != f; // { dg-error "error" }
+ b2 = ld != b32; // { dg-error "error" }
+ b3 = b64 != d; // { dg-error "error" }
+ b4 = ld != b64; // { dg-error "error" }
+ b5 = b128 != ld; // { dg-error "error" }
+ b6 = d != b128; // { dg-error "error" }
+}
+
+void
+bad_lt (void)
+{
+ b1 = b32 < f; // { dg-error "error" }
+ b2 = ld < b32; // { dg-error "error" }
+ b3 = b64 < d; // { dg-error "error" }
+ b4 = ld < b64; // { dg-error "error" }
+ b5 = b128 < ld; // { dg-error "error" }
+ b6 = d < b128; // { dg-error "error" }
+}
+
+void
+bad_le (void)
+{
+ b1 = b32 <= f; // { dg-error "error" }
+ b2 = ld <= b32; // { dg-error "error" }
+ b3 = b64 <= d; // { dg-error "error" }
+ b4 = ld <= b64; // { dg-error "error" }
+ b5 = b128 <= ld; // { dg-error "error" }
+ b6 = d <= b128; // { dg-error "error" }
+}
+
+void
+bad_gt (void)
+{
+ b1 = b32 > f; // { dg-error "error" }
+ b2 = ld > b32; // { dg-error "error" }
+ b3 = b64 > d; // { dg-error "error" }
+ b4 = ld > b64; // { dg-error "error" }
+ b5 = b128 > ld; // { dg-error "error" }
+ b6 = d > b128; // { dg-error "error" }
+}
+
+void
+bad_ge (void)
+{
+ b1 = b32 >= f; // { dg-error "error" }
+ b2 = ld >= b32; // { dg-error "error" }
+ b3 = b64 >= d; // { dg-error "error" }
+ b4 = ld >= b64; // { dg-error "error" }
+ b5 = b128 >= ld; // { dg-error "error" }
+ b6 = d >= b128; // { dg-error "error" }
+}
+
+void
+bad_pluseq (void)
+{
+ a32 += f; // { dg-error "error" }
+ a32 += d; // { dg-error "error" }
+ a32 += ld; // { dg-error "error" }
+ a64 += f; // { dg-error "error" }
+ a64 += d; // { dg-error "error" }
+ a64 += ld; // { dg-error "error" }
+ a128 += f; // { dg-error "error" }
+ a128 += d; // { dg-error "error" }
+ a128 += ld; // { dg-error "error" }
+}
+
+void
+bad_minuseq (void)
+{
+ a32 -= f; // { dg-error "error" }
+ a32 -= d; // { dg-error "error" }
+ a32 -= ld; // { dg-error "error" }
+ a64 -= f; // { dg-error "error" }
+ a64 -= d; // { dg-error "error" }
+ a64 -= ld; // { dg-error "error" }
+ a128 -= f; // { dg-error "error" }
+ a128 -= d; // { dg-error "error" }
+ a128 -= ld; // { dg-error "error" }
+}
+
+void
+bad_timeseq (void)
+{
+ a32 *= f; // { dg-error "error" }
+ a32 *= d; // { dg-error "error" }
+ a32 *= ld; // { dg-error "error" }
+ a64 *= f; // { dg-error "error" }
+ a64 *= d; // { dg-error "error" }
+ a64 *= ld; // { dg-error "error" }
+ a128 *= f; // { dg-error "error" }
+ a128 *= d; // { dg-error "error" }
+ a128 *= ld; // { dg-error "error" }
+}
+
+void
+bad_divideeq (void)
+{
+ a32 /= f; // { dg-error "error" }
+ a32 /= d; // { dg-error "error" }
+ a32 /= ld; // { dg-error "error" }
+ a64 /= f; // { dg-error "error" }
+ a64 /= d; // { dg-error "error" }
+ a64 /= ld; // { dg-error "error" }
+ a128 /= f; // { dg-error "error" }
+ a128 /= d; // { dg-error "error" }
+ a128 /= ld; // { dg-error "error" }
+}
+
+// { dg-excess-errors "notes about candidates" }
diff --git a/libstdc++-v3/testsuite/decimal/operator_neg.cc b/libstdc++-v3/testsuite/decimal/operator_neg.cc
new file mode 100644
index 0000000..d40af81
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/operator_neg.cc
@@ -0,0 +1,160 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+// { dg-require-effective-target-dfp }
+
+// Test that C++ binary operators that are restricted to integer operands
+// do not accept decimal float operands.
+
+#include <decimal/decimal>
+
+using namespace std::decimal;
+
+decimal32 a32, b32, c32;
+decimal64 a64, b64, c64;
+decimal128 a128, b128, c128;
+
+void
+modulus (void)
+{
+ a32 = b32 % c32; // { dg-error "error" }
+ a64 = b64 % c64; // { dg-error "error" }
+ a128 = b128 % c128; // { dg-error "error" }
+ a128 = b32 % c128; // { dg-error "error" }
+ a128 = b64 % c128; // { dg-error "error" }
+ a32 = 100 % c32; // { dg-error "error" }
+ a64 = 10 % c64; // { dg-error "error" }
+ a128 = 1000 % c128; // { dg-error "error" }
+ a32 = b32 % 7; // { dg-error "error" }
+ a64 = b64 % 5; // { dg-error "error" }
+ a128 = b128 % 3; // { dg-error "error" }
+}
+
+void
+bitwise_right_shift (void)
+{
+ a32 = b32 >> c32; // { dg-error "error" }
+ a64 = b64 >> c64; // { dg-error "error" }
+ a128 = b128 >> c128; // { dg-error "error" }
+ a128 = b32 >> c128; // { dg-error "error" }
+ a128 = b64 >> c128; // { dg-error "error" }
+ a32 = 100 >> c32; // { dg-error "error" }
+ a64 = 10 >> c64; // { dg-error "error" }
+ a128 = 1000 >> c128; // { dg-error "error" }
+ a32 = b32 >> 7; // { dg-error "error" }
+ a64 = b64 >> 5; // { dg-error "error" }
+ a128 = b128 >> 3; // { dg-error "error" }
+}
+
+void
+bitwise_left_shift (void)
+{
+ a32 = b32 << c32; // { dg-error "error" }
+ a64 = b64 << c64; // { dg-error "error" }
+ a128 = b128 << c128; // { dg-error "error" }
+ a128 = b32 << c128; // { dg-error "error" }
+ a128 = b64 << c128; // { dg-error "error" }
+ a32 = 100 << c32; // { dg-error "error" }
+ a64 = 10 << c64; // { dg-error "error" }
+ a128 = 1000 << c128; // { dg-error "error" }
+ a32 = b32 << 7; // { dg-error "error" }
+ a64 = b64 << 5; // { dg-error "error" }
+ a128 = b128 << 3; // { dg-error "error" }
+}
+
+void
+bitwise_exclusive_or (void)
+{
+ a32 = b32 ^ c32; // { dg-error "error" }
+ a64 = b64 ^ c64; // { dg-error "error" }
+ a128 = b128 ^ c128; // { dg-error "error" }
+ a128 = b32 ^ c128; // { dg-error "error" }
+ a128 = b64 ^ c128; // { dg-error "error" }
+ a32 = 100 ^ c32; // { dg-error "error" }
+ a64 = 10 ^ c64; // { dg-error "error" }
+ a128 = 1000 ^ c128; // { dg-error "error" }
+ a32 = b32 ^ 7; // { dg-error "error" }
+ a64 = b64 ^ 5; // { dg-error "error" }
+ a128 = b128 ^ 3; // { dg-error "error" }
+}
+
+void
+bitwise_inclusive_or (void)
+{
+ a32 = b32 | c32; // { dg-error "error" }
+ a64 = b64 | c64; // { dg-error "error" }
+ a128 = b128 | c128; // { dg-error "error" }
+ a128 = b32 | c128; // { dg-error "error" }
+ a128 = b64 | c128; // { dg-error "error" }
+ a32 = 100 | c32; // { dg-error "error" }
+ a64 = 10 | c64; // { dg-error "error" }
+ a128 = 1000 | c128; // { dg-error "error" }
+ a32 = b32 | 7; // { dg-error "error" }
+ a64 = b64 | 5; // { dg-error "error" }
+ a128 = b128 | 3; // { dg-error "error" }
+}
+
+void
+logical_and (void)
+{
+ a32 = b32 && c32; // { dg-error "error" }
+ a64 = b64 && c64; // { dg-error "error" }
+ a128 = b128 && c128; // { dg-error "error" }
+ a128 = b32 && c128; // { dg-error "error" }
+ a128 = b64 && c128; // { dg-error "error" }
+ a32 = 100 && c32; // { dg-error "error" }
+ a64 = 10 && c64; // { dg-error "error" }
+ a128 = 1000 && c128; // { dg-error "error" }
+ a32 = b32 && 7; // { dg-error "error" }
+ a64 = b64 && 5; // { dg-error "error" }
+ a128 = b128 && 3; // { dg-error "error" }
+}
+
+void
+logical_or (void)
+{
+ a32 = b32 || c32; // { dg-error "error" }
+ a64 = b64 || c64; // { dg-error "error" }
+ a128 = b128 || c128; // { dg-error "error" }
+ a128 = b32 || c128; // { dg-error "error" }
+ a128 = b64 || c128; // { dg-error "error" }
+ a32 = 100 || c32; // { dg-error "error" }
+ a64 = 10 || c64; // { dg-error "error" }
+ a128 = 1000 || c128; // { dg-error "error" }
+ a32 = b32 || 7; // { dg-error "error" }
+ a64 = b64 || 5; // { dg-error "error" }
+ a128 = b128 || 3; // { dg-error "error" }
+}
+
+void
+bitwise_complement (void)
+{
+ a32 = ~b32; // { dg-error "error" }
+ a64 = ~b64; // { dg-error "error" }
+ a128 = ~b128; // { dg-error "error" }
+}
+
+void
+logical_not (void)
+{
+ a32 = !b32; // { dg-error "error" }
+ a64 = !b64; // { dg-error "error" }
+ a128 = !b128; // { dg-error "error" }
+}
+
+// { dg-excess-errors "" { target *-*-* } }
diff --git a/libstdc++-v3/testsuite/decimal/unary-arith.cc b/libstdc++-v3/testsuite/decimal/unary-arith.cc
new file mode 100644
index 0000000..dcb8a08
--- /dev/null
+++ b/libstdc++-v3/testsuite/decimal/unary-arith.cc
@@ -0,0 +1,93 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-require-effective-target-dfp }
+
+// ISO/IEC TR 24733 3.2.7 Unary arithmetic operators.
+
+#include <decimal/decimal>
+#include <testsuite_hooks.h>
+
+using namespace std::decimal;
+
+decimal32 a32 (20), b32 (-20);
+decimal64 a64 (124), b64 (-124);
+decimal128 a128 (5001), b128 (-5001);
+
+void
+unary_plus_32 (void)
+{
+ decimal32 a;
+
+ a = +a32; VERIFY (a == a32);
+ a = +b32; VERIFY (a == b32);
+}
+
+void
+unary_minus_32 (void)
+{
+ decimal32 a;
+
+ a = -a32; VERIFY (a == b32);
+ a = -b32; VERIFY (a == a32);
+}
+
+void
+unary_plus_64 (void)
+{
+ decimal64 a;
+
+ a = +a64; VERIFY (a == a64);
+ a = +b64; VERIFY (a == b64);
+}
+
+void
+unary_minus_64 (void)
+{
+ decimal64 a;
+
+ a = -a64; VERIFY (a == b64);
+ a = -b64; VERIFY (a == a64);
+}
+
+void
+unary_plus_128 (void)
+{
+ decimal128 a;
+
+ a = +a128; VERIFY (a == a128);
+ a = +b128; VERIFY (a == b128);
+}
+
+void
+unary_minus_128 (void)
+{
+ decimal128 a;
+
+ a = -a128; VERIFY (a == b128);
+ a = -b128; VERIFY (a == a128);
+}
+
+int main ()
+{
+ unary_plus_32 ();
+ unary_minus_32 ();
+ unary_plus_64 ();
+ unary_minus_64 ();
+ unary_plus_128 ();
+ unary_minus_128 ();
+}