Commit ef859c9d by Paolo Carlini

[multiple changes]

2012-08-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* testsuite/decimal/mixed-mode-cmp_neg.cc: Add test variable; minor
	tweaks.
	* testsuite/decimal/unary-arith.cc: Likewise.
	* testsuite/decimal/ctor.cc: Likewise.
	* testsuite/decimal/conversion-to-integral.cc: Likewise.
	* testsuite/decimal/make-decimal.cc: Likewise.
	* testsuite/decimal/comparison.cc: Likewise.
	* testsuite/decimal/incdec-memfunc.cc: Likewise.
	* testsuite/decimal/conversion-to-generic-float.cc: Likewise.
	* testsuite/decimal/compound-assignment-memfunc.cc: Likewise.
	* testsuite/decimal/cast_neg.cc: Likewise.
	* testsuite/decimal/incdec.cc: Likewise.
	* testsuite/decimal/mixed-mode-arith_neg.cc: Likewise.
	* testsuite/decimal/binary-arith.cc: Likewise.
	* testsuite/decimal/conversion-from-float.cc: Likewise.
	* testsuite/decimal/conversion-from-integral.cc: Likewise.
	* testsuite/decimal/compound-assignment.cc: Likewise.

2012-08-06  Peter Bergner  <bergner@vnet.ibm.com>

	PR libstdc++/54036
	* include/decimal/decimal.h (_DEFINE_DECIMAL_UNARY_OP): Use _Op as
	a unary operator.
	* testsuite/decimal/pr54036-1.cc: New test.
	* testsuite/decimal/pr54036-2.cc: Likewise.
	* testsuite/decimal/pr54036-3.cc: Likewise.

From-SVN: r190186
parent 777d77b3
2012-08-06 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/decimal/mixed-mode-cmp_neg.cc: Add test variable; minor
tweaks.
* testsuite/decimal/unary-arith.cc: Likewise.
* testsuite/decimal/ctor.cc: Likewise.
* testsuite/decimal/conversion-to-integral.cc: Likewise.
* testsuite/decimal/make-decimal.cc: Likewise.
* testsuite/decimal/comparison.cc: Likewise.
* testsuite/decimal/incdec-memfunc.cc: Likewise.
* testsuite/decimal/conversion-to-generic-float.cc: Likewise.
* testsuite/decimal/compound-assignment-memfunc.cc: Likewise.
* testsuite/decimal/cast_neg.cc: Likewise.
* testsuite/decimal/incdec.cc: Likewise.
* testsuite/decimal/mixed-mode-arith_neg.cc: Likewise.
* testsuite/decimal/binary-arith.cc: Likewise.
* testsuite/decimal/conversion-from-float.cc: Likewise.
* testsuite/decimal/conversion-from-integral.cc: Likewise.
* testsuite/decimal/compound-assignment.cc: Likewise.
2012-08-06 Peter Bergner <bergner@vnet.ibm.com>
PR libstdc++/54036
* include/decimal/decimal.h (_DEFINE_DECIMAL_UNARY_OP): Use _Op as
a unary operator.
* testsuite/decimal/pr54036-1.cc: New test.
* testsuite/decimal/pr54036-2.cc: Likewise.
* testsuite/decimal/pr54036-3.cc: Likewise.
2012-08-04 Paolo Carlini <paolo.carlini@oracle.com> 2012-08-04 Paolo Carlini <paolo.carlini@oracle.com>
Revert: Revert:
......
...@@ -288,7 +288,7 @@ namespace decimal ...@@ -288,7 +288,7 @@ namespace decimal
inline _Tp operator _Op(_Tp __rhs) \ inline _Tp operator _Op(_Tp __rhs) \
{ \ { \
_Tp __tmp; \ _Tp __tmp; \
__tmp.__setval(0 _Op __rhs.__getval()); \ __tmp.__setval(_Op __rhs.__getval()); \
return __tmp; \ return __tmp; \
} }
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -37,6 +37,7 @@ unsigned long long ull = 50; ...@@ -37,6 +37,7 @@ unsigned long long ull = 50;
void void
binary_add_32 (void) binary_add_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = si + a; VERIFY (b == 980); b = si + a; VERIFY (b == 980);
...@@ -63,6 +64,7 @@ binary_add_32 (void) ...@@ -63,6 +64,7 @@ binary_add_32 (void)
void void
binary_subtract_32 (void) binary_subtract_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a - si; VERIFY (b == 1020); b = a - si; VERIFY (b == 1020);
...@@ -90,6 +92,7 @@ binary_subtract_32 (void) ...@@ -90,6 +92,7 @@ binary_subtract_32 (void)
void void
binary_multiply_32 (void) binary_multiply_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a * si; VERIFY (b == -20000); b = a * si; VERIFY (b == -20000);
...@@ -116,6 +119,7 @@ binary_multiply_32 (void) ...@@ -116,6 +119,7 @@ binary_multiply_32 (void)
void void
binary_divide_32 (void) binary_divide_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a / si; VERIFY (b == -50); b = a / si; VERIFY (b == -50);
...@@ -143,6 +147,7 @@ binary_divide_32 (void) ...@@ -143,6 +147,7 @@ binary_divide_32 (void)
void void
binary_add_64 (void) binary_add_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a + si; VERIFY (b == 980); b = a + si; VERIFY (b == 980);
...@@ -169,6 +174,7 @@ binary_add_64 (void) ...@@ -169,6 +174,7 @@ binary_add_64 (void)
void void
binary_subtract_64 (void) binary_subtract_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a - si; VERIFY (b == 1020); b = a - si; VERIFY (b == 1020);
...@@ -196,6 +202,7 @@ binary_subtract_64 (void) ...@@ -196,6 +202,7 @@ binary_subtract_64 (void)
void void
binary_multiply_64 (void) binary_multiply_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a * si; VERIFY (b == -20000); b = a * si; VERIFY (b == -20000);
...@@ -222,6 +229,7 @@ binary_multiply_64 (void) ...@@ -222,6 +229,7 @@ binary_multiply_64 (void)
void void
binary_divide_64 (void) binary_divide_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a / si; VERIFY (b == -50); b = a / si; VERIFY (b == -50);
...@@ -249,6 +257,7 @@ binary_divide_64 (void) ...@@ -249,6 +257,7 @@ binary_divide_64 (void)
void void
binary_add_128 (void) binary_add_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a + si; VERIFY (b == 980); b = a + si; VERIFY (b == 980);
...@@ -275,6 +284,7 @@ binary_add_128 (void) ...@@ -275,6 +284,7 @@ binary_add_128 (void)
void void
binary_subtract_128 (void) binary_subtract_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a - si; VERIFY (b == 1020); b = a - si; VERIFY (b == 1020);
...@@ -302,6 +312,7 @@ binary_subtract_128 (void) ...@@ -302,6 +312,7 @@ binary_subtract_128 (void)
void void
binary_multiply_128 (void) binary_multiply_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a * si; VERIFY (b == -20000); b = a * si; VERIFY (b == -20000);
...@@ -328,6 +339,7 @@ binary_multiply_128 (void) ...@@ -328,6 +339,7 @@ binary_multiply_128 (void)
void void
binary_divide_128 (void) binary_divide_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a / si; VERIFY (b == -50); b = a / si; VERIFY (b == -50);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
// attempt to do a cast are flagged as errors. // attempt to do a cast are flagged as errors.
#include <decimal/decimal> #include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal; using namespace std::decimal;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -37,6 +37,7 @@ unsigned long long ull = 50; ...@@ -37,6 +37,7 @@ unsigned long long ull = 50;
void void
compare_eq_32 (void) compare_eq_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
a = si; VERIFY (a == si); VERIFY (si == a); a = si; VERIFY (a == si); VERIFY (si == a);
...@@ -53,6 +54,7 @@ compare_eq_32 (void) ...@@ -53,6 +54,7 @@ compare_eq_32 (void)
void void
compare_ne_32 (void) compare_ne_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a = 100; decimal32 a = 100;
VERIFY (a != si); VERIFY (si != a); VERIFY (a != si); VERIFY (si != a);
...@@ -69,6 +71,7 @@ compare_ne_32 (void) ...@@ -69,6 +71,7 @@ compare_ne_32 (void)
void void
compare_lt_32 (void) compare_lt_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a = -100; decimal32 a = -100;
VERIFY (a < si); VERIFY (a < si);
...@@ -96,6 +99,7 @@ compare_lt_32 (void) ...@@ -96,6 +99,7 @@ compare_lt_32 (void)
void void
compare_le_32 (void) compare_le_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
a = si; VERIFY (a <= si); VERIFY (si <= a); a = si; VERIFY (a <= si); VERIFY (si <= a);
...@@ -134,6 +138,7 @@ compare_le_32 (void) ...@@ -134,6 +138,7 @@ compare_le_32 (void)
void void
compare_gt_32 (void) compare_gt_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a = 100; decimal32 a = 100;
VERIFY (a > si); VERIFY (a > si);
...@@ -161,6 +166,7 @@ compare_gt_32 (void) ...@@ -161,6 +166,7 @@ compare_gt_32 (void)
void void
compare_ge_32 (void) compare_ge_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
a = si; VERIFY (a >= si); VERIFY (si <= a); a = si; VERIFY (a >= si); VERIFY (si <= a);
...@@ -199,6 +205,7 @@ compare_ge_32 (void) ...@@ -199,6 +205,7 @@ compare_ge_32 (void)
void void
compare_eq_64 (void) compare_eq_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
a = si; VERIFY (a == si); VERIFY (si == a); a = si; VERIFY (a == si); VERIFY (si == a);
...@@ -215,6 +222,7 @@ compare_eq_64 (void) ...@@ -215,6 +222,7 @@ compare_eq_64 (void)
void void
compare_ne_64 (void) compare_ne_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a = 100; decimal64 a = 100;
VERIFY (a != si); VERIFY (si != a); VERIFY (a != si); VERIFY (si != a);
...@@ -231,6 +239,7 @@ compare_ne_64 (void) ...@@ -231,6 +239,7 @@ compare_ne_64 (void)
void void
compare_lt_64 (void) compare_lt_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a = -100; decimal64 a = -100;
VERIFY (a < si); VERIFY (a < si);
...@@ -258,6 +267,7 @@ compare_lt_64 (void) ...@@ -258,6 +267,7 @@ compare_lt_64 (void)
void void
compare_le_64 (void) compare_le_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
a = si; VERIFY (a <= si); VERIFY (si <= a); a = si; VERIFY (a <= si); VERIFY (si <= a);
...@@ -296,6 +306,7 @@ compare_le_64 (void) ...@@ -296,6 +306,7 @@ compare_le_64 (void)
void void
compare_gt_64 (void) compare_gt_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a = 100; decimal64 a = 100;
VERIFY (a > si); VERIFY (a > si);
...@@ -323,6 +334,7 @@ compare_gt_64 (void) ...@@ -323,6 +334,7 @@ compare_gt_64 (void)
void void
compare_ge_64 (void) compare_ge_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
a = si; VERIFY (a >= si); VERIFY (si <= a); a = si; VERIFY (a >= si); VERIFY (si <= a);
...@@ -361,6 +373,7 @@ compare_ge_64 (void) ...@@ -361,6 +373,7 @@ compare_ge_64 (void)
void void
compare_eq_128 (void) compare_eq_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
a = si; VERIFY (a == si); VERIFY (si == a); a = si; VERIFY (a == si); VERIFY (si == a);
...@@ -377,6 +390,7 @@ compare_eq_128 (void) ...@@ -377,6 +390,7 @@ compare_eq_128 (void)
void void
compare_ne_128 (void) compare_ne_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a = 100; decimal128 a = 100;
VERIFY (a != si); VERIFY (si != a); VERIFY (a != si); VERIFY (si != a);
...@@ -393,6 +407,7 @@ compare_ne_128 (void) ...@@ -393,6 +407,7 @@ compare_ne_128 (void)
void void
compare_lt_128 (void) compare_lt_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a = -100; decimal128 a = -100;
VERIFY (a < si); VERIFY (a < si);
...@@ -420,6 +435,7 @@ compare_lt_128 (void) ...@@ -420,6 +435,7 @@ compare_lt_128 (void)
void void
compare_le_128 (void) compare_le_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
a = si; VERIFY (a <= si); VERIFY (si <= a); a = si; VERIFY (a <= si); VERIFY (si <= a);
...@@ -458,6 +474,7 @@ compare_le_128 (void) ...@@ -458,6 +474,7 @@ compare_le_128 (void)
void void
compare_gt_128 (void) compare_gt_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a = 100; decimal128 a = 100;
VERIFY (a > si); VERIFY (a > si);
...@@ -485,6 +502,7 @@ compare_gt_128 (void) ...@@ -485,6 +502,7 @@ compare_gt_128 (void)
void void
compare_ge_128 (void) compare_ge_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
a = si; VERIFY (a >= si); VERIFY (si <= a); a = si; VERIFY (a >= si); VERIFY (si <= a);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -41,6 +41,7 @@ unsigned long long ull = 50; ...@@ -41,6 +41,7 @@ unsigned long long ull = 50;
void void
compound_assignment_add_32 (void) compound_assignment_add_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005); b = a; b.operator+=(d32); VERIFY (b == 1005);
...@@ -57,6 +58,7 @@ compound_assignment_add_32 (void) ...@@ -57,6 +58,7 @@ compound_assignment_add_32 (void)
void void
compound_assignment_subtract_32 (void) compound_assignment_subtract_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995); b = a; b.operator-=(d32); VERIFY (b == 995);
...@@ -73,6 +75,7 @@ compound_assignment_subtract_32 (void) ...@@ -73,6 +75,7 @@ compound_assignment_subtract_32 (void)
void void
compound_assignment_multiply_32 (void) compound_assignment_multiply_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000); b = a; b.operator*=(d32); VERIFY (b == 5000);
...@@ -89,6 +92,7 @@ compound_assignment_multiply_32 (void) ...@@ -89,6 +92,7 @@ compound_assignment_multiply_32 (void)
void void
compound_assignment_divide_32 (void) compound_assignment_divide_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200); b = a; b.operator/=(d32); VERIFY (b == 200);
...@@ -105,6 +109,7 @@ compound_assignment_divide_32 (void) ...@@ -105,6 +109,7 @@ compound_assignment_divide_32 (void)
void void
compound_assignment_add_64 (void) compound_assignment_add_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005); b = a; b.operator+=(d32); VERIFY (b == 1005);
...@@ -121,6 +126,7 @@ compound_assignment_add_64 (void) ...@@ -121,6 +126,7 @@ compound_assignment_add_64 (void)
void void
compound_assignment_subtract_64 (void) compound_assignment_subtract_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995); b = a; b.operator-=(d32); VERIFY (b == 995);
...@@ -137,6 +143,7 @@ compound_assignment_subtract_64 (void) ...@@ -137,6 +143,7 @@ compound_assignment_subtract_64 (void)
void void
compound_assignment_multiply_64 (void) compound_assignment_multiply_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000); b = a; b.operator*=(d32); VERIFY (b == 5000);
...@@ -153,6 +160,7 @@ compound_assignment_multiply_64 (void) ...@@ -153,6 +160,7 @@ compound_assignment_multiply_64 (void)
void void
compound_assignment_divide_64 (void) compound_assignment_divide_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200); b = a; b.operator/=(d32); VERIFY (b == 200);
...@@ -169,6 +177,7 @@ compound_assignment_divide_64 (void) ...@@ -169,6 +177,7 @@ compound_assignment_divide_64 (void)
void void
compound_assignment_add_128 (void) compound_assignment_add_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005); b = a; b.operator+=(d32); VERIFY (b == 1005);
...@@ -185,6 +194,7 @@ compound_assignment_add_128 (void) ...@@ -185,6 +194,7 @@ compound_assignment_add_128 (void)
void void
compound_assignment_subtract_128 (void) compound_assignment_subtract_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995); b = a; b.operator-=(d32); VERIFY (b == 995);
...@@ -201,6 +211,7 @@ compound_assignment_subtract_128 (void) ...@@ -201,6 +211,7 @@ compound_assignment_subtract_128 (void)
void void
compound_assignment_multiply_128 (void) compound_assignment_multiply_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000); b = a; b.operator*=(d32); VERIFY (b == 5000);
...@@ -217,6 +228,7 @@ compound_assignment_multiply_128 (void) ...@@ -217,6 +228,7 @@ compound_assignment_multiply_128 (void)
void void
compound_assignment_divide_128 (void) compound_assignment_divide_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200); b = a; b.operator/=(d32); VERIFY (b == 200);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -39,6 +39,7 @@ unsigned long long ull = 50; ...@@ -39,6 +39,7 @@ unsigned long long ull = 50;
void void
compound_assignment_add_32 (void) compound_assignment_add_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b += d32; VERIFY (b == 1005); b = a; b += d32; VERIFY (b == 1005);
...@@ -55,6 +56,7 @@ compound_assignment_add_32 (void) ...@@ -55,6 +56,7 @@ compound_assignment_add_32 (void)
void void
compound_assignment_subtract_32 (void) compound_assignment_subtract_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b -= d32; VERIFY (b == 995); b = a; b -= d32; VERIFY (b == 995);
...@@ -71,6 +73,7 @@ compound_assignment_subtract_32 (void) ...@@ -71,6 +73,7 @@ compound_assignment_subtract_32 (void)
void void
compound_assignment_multiply_32 (void) compound_assignment_multiply_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000); b = a; b *= d32; VERIFY (b == 5000);
...@@ -87,6 +90,7 @@ compound_assignment_multiply_32 (void) ...@@ -87,6 +90,7 @@ compound_assignment_multiply_32 (void)
void void
compound_assignment_divide_32 (void) compound_assignment_divide_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a (1000), b; decimal32 a (1000), b;
b = a; b /= d32; VERIFY (b == 200); b = a; b /= d32; VERIFY (b == 200);
...@@ -103,6 +107,7 @@ compound_assignment_divide_32 (void) ...@@ -103,6 +107,7 @@ compound_assignment_divide_32 (void)
void void
compound_assignment_add_64 (void) compound_assignment_add_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b += d32; VERIFY (b == 1005); b = a; b += d32; VERIFY (b == 1005);
...@@ -119,6 +124,7 @@ compound_assignment_add_64 (void) ...@@ -119,6 +124,7 @@ compound_assignment_add_64 (void)
void void
compound_assignment_subtract_64 (void) compound_assignment_subtract_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b -= d32; VERIFY (b == 995); b = a; b -= d32; VERIFY (b == 995);
...@@ -135,6 +141,7 @@ compound_assignment_subtract_64 (void) ...@@ -135,6 +141,7 @@ compound_assignment_subtract_64 (void)
void void
compound_assignment_multiply_64 (void) compound_assignment_multiply_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000); b = a; b *= d32; VERIFY (b == 5000);
...@@ -151,6 +158,7 @@ compound_assignment_multiply_64 (void) ...@@ -151,6 +158,7 @@ compound_assignment_multiply_64 (void)
void void
compound_assignment_divide_64 (void) compound_assignment_divide_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a (1000), b; decimal64 a (1000), b;
b = a; b /= d32; VERIFY (b == 200); b = a; b /= d32; VERIFY (b == 200);
...@@ -167,6 +175,7 @@ compound_assignment_divide_64 (void) ...@@ -167,6 +175,7 @@ compound_assignment_divide_64 (void)
void void
compound_assignment_add_128 (void) compound_assignment_add_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b += d32; VERIFY (b == 1005); b = a; b += d32; VERIFY (b == 1005);
...@@ -183,6 +192,7 @@ compound_assignment_add_128 (void) ...@@ -183,6 +192,7 @@ compound_assignment_add_128 (void)
void void
compound_assignment_subtract_128 (void) compound_assignment_subtract_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b -= d32; VERIFY (b == 995); b = a; b -= d32; VERIFY (b == 995);
...@@ -199,6 +209,7 @@ compound_assignment_subtract_128 (void) ...@@ -199,6 +209,7 @@ compound_assignment_subtract_128 (void)
void void
compound_assignment_multiply_128 (void) compound_assignment_multiply_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000); b = a; b *= d32; VERIFY (b == 5000);
...@@ -215,6 +226,7 @@ compound_assignment_multiply_128 (void) ...@@ -215,6 +226,7 @@ compound_assignment_multiply_128 (void)
void void
compound_assignment_divide_128 (void) compound_assignment_divide_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a (1000), b; decimal128 a (1000), b;
b = a; b /= d32; VERIFY (b == 200); b = a; b /= d32; VERIFY (b == 200);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -29,6 +29,7 @@ using namespace std::decimal; ...@@ -29,6 +29,7 @@ using namespace std::decimal;
void void
conversion_from_float_32 () conversion_from_float_32 ()
{ {
bool test __attribute__((unused)) = true;
decimal32 d32(123); decimal32 d32(123);
decimal64 d64(234); decimal64 d64(234);
decimal128 d128(345); decimal128 d128(345);
...@@ -51,6 +52,7 @@ conversion_from_float_32 () ...@@ -51,6 +52,7 @@ conversion_from_float_32 ()
void void
conversion_from_float_64 () conversion_from_float_64 ()
{ {
bool test __attribute__((unused)) = true;
decimal32 d32(123); decimal32 d32(123);
decimal64 d64(234); decimal64 d64(234);
decimal128 d128(345); decimal128 d128(345);
...@@ -73,6 +75,7 @@ conversion_from_float_64 () ...@@ -73,6 +75,7 @@ conversion_from_float_64 ()
void void
conversion_from_float_128 () conversion_from_float_128 ()
{ {
bool test __attribute__((unused)) = true;
decimal32 d32(123); decimal32 d32(123);
decimal64 d64(234); decimal64 d64(234);
decimal128 d128(345); decimal128 d128(345);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -29,6 +29,7 @@ using namespace std::decimal; ...@@ -29,6 +29,7 @@ using namespace std::decimal;
void void
conversion_from_integral_p32 () conversion_from_integral_p32 ()
{ {
bool test __attribute__((unused)) = true;
decimal32 d; decimal32 d;
decimal32 from_si (1); decimal32 from_si (1);
decimal32 from_ui (2U); decimal32 from_ui (2U);
...@@ -61,6 +62,7 @@ conversion_from_integral_p32 () ...@@ -61,6 +62,7 @@ conversion_from_integral_p32 ()
void void
conversion_from_integral_m32 () conversion_from_integral_m32 ()
{ {
bool test __attribute__((unused)) = true;
decimal32 d; decimal32 d;
decimal32 from_si (-1); decimal32 from_si (-1);
decimal32 from_sl (-2L); decimal32 from_sl (-2L);
...@@ -81,6 +83,7 @@ conversion_from_integral_m32 () ...@@ -81,6 +83,7 @@ conversion_from_integral_m32 ()
void void
conversion_from_integral_p64 () conversion_from_integral_p64 ()
{ {
bool test __attribute__((unused)) = true;
decimal64 d; decimal64 d;
decimal64 from_si (1); decimal64 from_si (1);
decimal64 from_ui (2U); decimal64 from_ui (2U);
...@@ -113,6 +116,7 @@ conversion_from_integral_p64 () ...@@ -113,6 +116,7 @@ conversion_from_integral_p64 ()
void void
conversion_from_integral_m64 () conversion_from_integral_m64 ()
{ {
bool test __attribute__((unused)) = true;
decimal64 d; decimal64 d;
decimal64 from_si (-1); decimal64 from_si (-1);
decimal64 from_sl (-2L); decimal64 from_sl (-2L);
...@@ -133,6 +137,7 @@ conversion_from_integral_m64 () ...@@ -133,6 +137,7 @@ conversion_from_integral_m64 ()
void void
conversion_from_integral_p128 () conversion_from_integral_p128 ()
{ {
bool test __attribute__((unused)) = true;
decimal128 d; decimal128 d;
decimal128 from_si (1); decimal128 from_si (1);
decimal128 from_ui (2U); decimal128 from_ui (2U);
...@@ -164,6 +169,7 @@ conversion_from_integral_p128 () ...@@ -164,6 +169,7 @@ conversion_from_integral_p128 ()
void void
conversion_from_integral_m128 () conversion_from_integral_m128 ()
{ {
bool test __attribute__((unused)) = true;
decimal128 d; decimal128 d;
decimal128 from_si (-1); decimal128 from_si (-1);
decimal128 from_sl (-2L); decimal128 from_sl (-2L);
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -27,7 +27,8 @@ using namespace std::decimal; ...@@ -27,7 +27,8 @@ using namespace std::decimal;
void void
conversion_to_generic_float_32 () conversion_to_generic_float_32 ()
{ {
std::decimal::decimal32 d32(123); bool test __attribute__((unused)) = true;
decimal32 d32(123);
float f; float f;
double d; double d;
long double ld; long double ld;
...@@ -51,7 +52,8 @@ conversion_to_generic_float_32 () ...@@ -51,7 +52,8 @@ conversion_to_generic_float_32 ()
void void
conversion_to_generic_float_64 () conversion_to_generic_float_64 ()
{ {
std::decimal::decimal64 d64(234); bool test __attribute__((unused)) = true;
decimal64 d64(234);
float f; float f;
double d; double d;
long double ld; long double ld;
...@@ -75,7 +77,8 @@ conversion_to_generic_float_64 () ...@@ -75,7 +77,8 @@ conversion_to_generic_float_64 ()
void void
conversion_to_generic_float_128 () conversion_to_generic_float_128 ()
{ {
std::decimal::decimal128 d128(345); bool test __attribute__((unused)) = true;
decimal128 d128(345);
float f; float f;
double d; double d;
long double ld; long double ld;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <decimal/decimal> #include <decimal/decimal>
#include <climits> #include <climits>
#include <cstdio>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
// Use extension to replace implicit long long conversion with function call. // Use extension to replace implicit long long conversion with function call.
...@@ -36,6 +35,7 @@ conversion_to_integral_32 (void) ...@@ -36,6 +35,7 @@ conversion_to_integral_32 (void)
{ {
#undef MAXVAL #undef MAXVAL
#define MAXVAL 999999LL #define MAXVAL 999999LL
bool test __attribute__((unused)) = true;
decimal32 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL); decimal32 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll; long long ll;
...@@ -51,6 +51,7 @@ conversion_to_integral_64 (void) ...@@ -51,6 +51,7 @@ conversion_to_integral_64 (void)
{ {
#undef MAXVAL #undef MAXVAL
#define MAXVAL 999999999999999LL #define MAXVAL 999999999999999LL
bool test __attribute__((unused)) = true;
decimal64 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL); decimal64 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll; long long ll;
...@@ -66,6 +67,7 @@ conversion_to_integral_128 (void) ...@@ -66,6 +67,7 @@ conversion_to_integral_128 (void)
{ {
#undef MAXVAL #undef MAXVAL
#define MAXVAL LONG_LONG_MAX #define MAXVAL LONG_LONG_MAX
bool test __attribute__((unused)) = true;
decimal128 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL); decimal128 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll; long long ll;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -32,28 +32,31 @@ using namespace std::decimal; ...@@ -32,28 +32,31 @@ using namespace std::decimal;
void void
ctor_32 (void) ctor_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
float b __attribute__((mode(SD))) = 0.e-101DF; float b __attribute__((mode(SD))) = 0.e-101DF;
VERIFY (memcmp (&a, &b, 4) == 0); VERIFY (std::memcmp (&a, &b, 4) == 0);
} }
void void
ctor_64 (void) ctor_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
float b __attribute__((mode(DD))) = 0.e-398DD; float b __attribute__((mode(DD))) = 0.e-398DD;
VERIFY (memcmp (&a, &b, 8) == 0); VERIFY (std::memcmp (&a, &b, 8) == 0);
} }
void void
ctor_128 (void) ctor_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
float b __attribute__((mode(TD))) = 0.e-6176DL; float b __attribute__((mode(TD))) = 0.e-6176DL;
VERIFY (memcmp (&a, &b, 16) == 0); VERIFY (std::memcmp (&a, &b, 16) == 0);
} }
int int
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -34,8 +34,9 @@ using namespace std::decimal; ...@@ -34,8 +34,9 @@ using namespace std::decimal;
void void
incdec32 (void) incdec32 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal32 a(11), b, c; decimal32 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
...@@ -81,8 +82,9 @@ incdec32 (void) ...@@ -81,8 +82,9 @@ incdec32 (void)
void void
incdec64 (void) incdec64 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal64 a(11), b, c; decimal64 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
...@@ -128,8 +130,9 @@ incdec64 (void) ...@@ -128,8 +130,9 @@ incdec64 (void)
void void
incdec128 (void) incdec128 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal128 a(11), b, c; decimal128 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -32,8 +32,9 @@ using namespace std::decimal; ...@@ -32,8 +32,9 @@ using namespace std::decimal;
void void
incdec32 (void) incdec32 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal32 a(11), b, c; decimal32 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
...@@ -79,8 +80,9 @@ incdec32 (void) ...@@ -79,8 +80,9 @@ incdec32 (void)
void void
incdec64 (void) incdec64 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal64 a(11), b, c; decimal64 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
...@@ -126,8 +128,9 @@ incdec64 (void) ...@@ -126,8 +128,9 @@ incdec64 (void)
void void
incdec128 (void) incdec128 (void)
{ {
bool test __attribute__((unused)) = true;
int ival; int ival;
std::decimal::decimal128 a(11), b, c; decimal128 a(11), b, c;
// Verify that we get the expected value of b after assignment. // Verify that we get the expected value of b after assignment.
b = a; b = a;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
i = ESIGN EXP; \ i = ESIGN EXP; \
a = PASTE(make_decimal,32) (sll, i); \ a = PASTE(make_decimal,32) (sll, i); \
b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \ b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \
VERIFY ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) == 0) \ VERIFY ((std::memcmp ((void *)&x, (void *)&a, SIZE) == 0) \
&& (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) == 0)); && (std::memcmp ((void *)&x, (void *)&b,SIZE) == 0));
#define TESTVAL_NONNEG(COEFF,ESIGN,EXP,SUF,NUM,SIZE) \ #define TESTVAL_NONNEG(COEFF,ESIGN,EXP,SUF,NUM,SIZE) \
x = PASTE(PASTE(PASTE(PASTE(PASTE(COEFF,.),E),ESIGN),EXP),SUF); \ x = PASTE(PASTE(PASTE(PASTE(PASTE(COEFF,.),E),ESIGN),EXP),SUF); \
...@@ -44,16 +44,17 @@ ...@@ -44,16 +44,17 @@
b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \ b = PASTE(make_decimal,32) (PASTE(COEFF,LL), ESIGN EXP); \
c = PASTE(make_decimal,32) (ull, i); \ c = PASTE(make_decimal,32) (ull, i); \
d = PASTE(make_decimal,32) (PASTE(COEFF,ULL), ESIGN EXP); \ d = PASTE(make_decimal,32) (PASTE(COEFF,ULL), ESIGN EXP); \
VERIFY ((__builtin_memcmp ((void *)&x, (void *)&a, SIZE) == 0) \ VERIFY ((std::memcmp ((void *)&x, (void *)&a, SIZE) == 0) \
&& (__builtin_memcmp ((void *)&x, (void *)&b,SIZE) == 0) \ && (std::memcmp ((void *)&x, (void *)&b,SIZE) == 0) \
&& (__builtin_memcmp ((void *)&x, (void *)&c,SIZE) == 0) \ && (std::memcmp ((void *)&x, (void *)&c,SIZE) == 0) \
&& (__builtin_memcmp ((void *)&x, (void *)&d,SIZE) == 0)); && (std::memcmp ((void *)&x, (void *)&d,SIZE) == 0));
using namespace std::decimal; using namespace std::decimal;
void void
make_decimal_32 (void) make_decimal_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a, b, c, d; decimal32 a, b, c, d;
float x __attribute__((mode(SD))); float x __attribute__((mode(SD)));
int i; int i;
...@@ -78,6 +79,7 @@ make_decimal_32 (void) ...@@ -78,6 +79,7 @@ make_decimal_32 (void)
void void
make_decimal_64 (void) make_decimal_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a, b, c, d; decimal64 a, b, c, d;
float x __attribute__((mode(DD))); float x __attribute__((mode(DD)));
int i; int i;
...@@ -102,6 +104,7 @@ make_decimal_64 (void) ...@@ -102,6 +104,7 @@ make_decimal_64 (void)
void void
make_decimal_128 (void) make_decimal_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a, b, c, d; decimal128 a, b, c, d;
float x __attribute__((mode(TD))); float x __attribute__((mode(TD)));
int i; int i;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
// floating-point type to a generic floating-point type. // floating-point type to a generic floating-point type.
#include <decimal/decimal> #include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal; using namespace std::decimal;
......
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
// generic floating-point type. // generic floating-point type.
#include <decimal/decimal> #include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal; using namespace std::decimal;
......
// Copyright (C) 2012 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 }
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;
decimal32
__attribute__ ((noinline))
my_nan32 (void)
{
decimal32 z = 0;
decimal32 v = z/z;
return v;
}
decimal32
__attribute__ ((noinline))
my_inf32 (void)
{
decimal32 o = 1;
decimal32 z = 0;
decimal32 v = o/z;
return v;
}
int
main ()
{
bool test __attribute__((unused)) = true;
decimal32 v;
v = my_nan32 ();
VERIFY (__builtin_isnand32 (v.__getval ()));
VERIFY (!__builtin_signbitd32 (v.__getval ()));
v = -v;
VERIFY (__builtin_isnand32 (v.__getval ()));
VERIFY (__builtin_signbitd32 (v.__getval ()));
v = my_inf32 ();
VERIFY (__builtin_isinfd32 (v.__getval ()));
VERIFY (!__builtin_signbitd32 (v.__getval ()));
v = -v;
VERIFY (__builtin_isinfd32 (v.__getval ()));
VERIFY (__builtin_signbitd32 (v.__getval ()));
return 0;
}
// Copyright (C) 2012 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 }
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;
decimal64
__attribute__ ((noinline))
my_nan64 (void)
{
decimal64 z = 0;
decimal64 v = z/z;
return v;
}
decimal64
__attribute__ ((noinline))
my_inf64 (void)
{
decimal64 o = 1;
decimal64 z = 0;
decimal64 v = o/z;
return v;
}
int
main ()
{
bool test __attribute__((unused)) = true;
decimal64 v;
v = my_nan64 ();
VERIFY (__builtin_isnand64 (v.__getval ()));
VERIFY (!__builtin_signbitd64 (v.__getval ()));
v = -v;
VERIFY (__builtin_isnand64 (v.__getval ()));
VERIFY (__builtin_signbitd64 (v.__getval ()));
v = my_inf64 ();
VERIFY (__builtin_isinfd64 (v.__getval ()));
VERIFY (!__builtin_signbitd64 (v.__getval ()));
v = -v;
VERIFY (__builtin_isinfd64 (v.__getval ()));
VERIFY (__builtin_signbitd64 (v.__getval ()));
return 0;
}
// Copyright (C) 2012 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 }
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;
decimal128
__attribute__ ((noinline))
my_nan128 (void)
{
decimal128 z = 0;
decimal128 v = z/z;
return v;
}
decimal128
__attribute__ ((noinline))
my_inf128 (void)
{
decimal128 o = 1;
decimal128 z = 0;
decimal128 v = o/z;
return v;
}
int
main ()
{
bool test __attribute__((unused)) = true;
decimal128 v;
v = my_nan128 ();
VERIFY (__builtin_isnand128 (v.__getval ()));
VERIFY (!__builtin_signbitd128 (v.__getval ()));
v = -v;
VERIFY (__builtin_isnand128 (v.__getval ()));
VERIFY (__builtin_signbitd128 (v.__getval ()));
v = my_inf128 ();
VERIFY (__builtin_isinfd128 (v.__getval ()));
VERIFY (!__builtin_signbitd128 (v.__getval ()));
v = -v;
VERIFY (__builtin_isinfd128 (v.__getval ()));
VERIFY (__builtin_signbitd128 (v.__getval ()));
return 0;
}
// Copyright (C) 2009 Free Software Foundation, Inc. // Copyright (C) 2009-2012 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -31,6 +31,7 @@ decimal128 a128 (5001), b128 (-5001); ...@@ -31,6 +31,7 @@ decimal128 a128 (5001), b128 (-5001);
void void
unary_plus_32 (void) unary_plus_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
a = +a32; VERIFY (a == a32); a = +a32; VERIFY (a == a32);
...@@ -40,6 +41,7 @@ unary_plus_32 (void) ...@@ -40,6 +41,7 @@ unary_plus_32 (void)
void void
unary_minus_32 (void) unary_minus_32 (void)
{ {
bool test __attribute__((unused)) = true;
decimal32 a; decimal32 a;
a = -a32; VERIFY (a == b32); a = -a32; VERIFY (a == b32);
...@@ -49,6 +51,7 @@ unary_minus_32 (void) ...@@ -49,6 +51,7 @@ unary_minus_32 (void)
void void
unary_plus_64 (void) unary_plus_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
a = +a64; VERIFY (a == a64); a = +a64; VERIFY (a == a64);
...@@ -58,6 +61,7 @@ unary_plus_64 (void) ...@@ -58,6 +61,7 @@ unary_plus_64 (void)
void void
unary_minus_64 (void) unary_minus_64 (void)
{ {
bool test __attribute__((unused)) = true;
decimal64 a; decimal64 a;
a = -a64; VERIFY (a == b64); a = -a64; VERIFY (a == b64);
...@@ -67,6 +71,7 @@ unary_minus_64 (void) ...@@ -67,6 +71,7 @@ unary_minus_64 (void)
void void
unary_plus_128 (void) unary_plus_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
a = +a128; VERIFY (a == a128); a = +a128; VERIFY (a == a128);
...@@ -76,6 +81,7 @@ unary_plus_128 (void) ...@@ -76,6 +81,7 @@ unary_plus_128 (void)
void void
unary_minus_128 (void) unary_minus_128 (void)
{ {
bool test __attribute__((unused)) = true;
decimal128 a; decimal128 a;
a = -a128; VERIFY (a == b128); a = -a128; VERIFY (a == b128);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment