[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
This commit is contained in:
Paolo Carlini 2012-08-06 18:06:42 +00:00
parent 777d77b37a
commit ef859c9d3c
21 changed files with 364 additions and 39 deletions

View File

@ -1,3 +1,32 @@
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>
Revert:

View File

@ -288,7 +288,7 @@ namespace decimal
inline _Tp operator _Op(_Tp __rhs) \
{ \
_Tp __tmp; \
__tmp.__setval(0 _Op __rhs.__getval()); \
__tmp.__setval(_Op __rhs.__getval()); \
return __tmp; \
}

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -37,6 +37,7 @@ unsigned long long ull = 50;
void
binary_add_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = si + a; VERIFY (b == 980);
@ -63,6 +64,7 @@ binary_add_32 (void)
void
binary_subtract_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a - si; VERIFY (b == 1020);
@ -90,6 +92,7 @@ binary_subtract_32 (void)
void
binary_multiply_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a * si; VERIFY (b == -20000);
@ -116,6 +119,7 @@ binary_multiply_32 (void)
void
binary_divide_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a / si; VERIFY (b == -50);
@ -143,6 +147,7 @@ binary_divide_32 (void)
void
binary_add_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a + si; VERIFY (b == 980);
@ -169,6 +174,7 @@ binary_add_64 (void)
void
binary_subtract_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a - si; VERIFY (b == 1020);
@ -196,6 +202,7 @@ binary_subtract_64 (void)
void
binary_multiply_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a * si; VERIFY (b == -20000);
@ -222,6 +229,7 @@ binary_multiply_64 (void)
void
binary_divide_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a / si; VERIFY (b == -50);
@ -249,6 +257,7 @@ binary_divide_64 (void)
void
binary_add_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a + si; VERIFY (b == 980);
@ -275,6 +284,7 @@ binary_add_128 (void)
void
binary_subtract_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a - si; VERIFY (b == 1020);
@ -302,6 +312,7 @@ binary_subtract_128 (void)
void
binary_multiply_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a * si; VERIFY (b == -20000);
@ -328,6 +339,7 @@ binary_multiply_128 (void)
void
binary_divide_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a / si; VERIFY (b == -50);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -26,7 +26,6 @@
// attempt to do a cast are flagged as errors.
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -37,6 +37,7 @@ unsigned long long ull = 50;
void
compare_eq_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a == si); VERIFY (si == a);
@ -53,6 +54,7 @@ compare_eq_32 (void)
void
compare_ne_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a = 100;
VERIFY (a != si); VERIFY (si != a);
@ -69,6 +71,7 @@ compare_ne_32 (void)
void
compare_lt_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a = -100;
VERIFY (a < si);
@ -96,6 +99,7 @@ compare_lt_32 (void)
void
compare_le_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
@ -134,6 +138,7 @@ compare_le_32 (void)
void
compare_gt_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a = 100;
VERIFY (a > si);
@ -161,6 +166,7 @@ compare_gt_32 (void)
void
compare_ge_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a >= si); VERIFY (si <= a);
@ -199,6 +205,7 @@ compare_ge_32 (void)
void
compare_eq_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a == si); VERIFY (si == a);
@ -215,6 +222,7 @@ compare_eq_64 (void)
void
compare_ne_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a = 100;
VERIFY (a != si); VERIFY (si != a);
@ -231,6 +239,7 @@ compare_ne_64 (void)
void
compare_lt_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a = -100;
VERIFY (a < si);
@ -258,6 +267,7 @@ compare_lt_64 (void)
void
compare_le_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
@ -296,6 +306,7 @@ compare_le_64 (void)
void
compare_gt_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a = 100;
VERIFY (a > si);
@ -323,6 +334,7 @@ compare_gt_64 (void)
void
compare_ge_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a >= si); VERIFY (si <= a);
@ -361,6 +373,7 @@ compare_ge_64 (void)
void
compare_eq_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
a = si; VERIFY (a == si); VERIFY (si == a);
@ -377,6 +390,7 @@ compare_eq_128 (void)
void
compare_ne_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a = 100;
VERIFY (a != si); VERIFY (si != a);
@ -393,6 +407,7 @@ compare_ne_128 (void)
void
compare_lt_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a = -100;
VERIFY (a < si);
@ -420,6 +435,7 @@ compare_lt_128 (void)
void
compare_le_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
@ -458,6 +474,7 @@ compare_le_128 (void)
void
compare_gt_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a = 100;
VERIFY (a > si);
@ -485,6 +502,7 @@ compare_gt_128 (void)
void
compare_ge_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
a = si; VERIFY (a >= si); VERIFY (si <= a);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -41,6 +41,7 @@ unsigned long long ull = 50;
void
compound_assignment_add_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
@ -57,6 +58,7 @@ compound_assignment_add_32 (void)
void
compound_assignment_subtract_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
@ -73,6 +75,7 @@ compound_assignment_subtract_32 (void)
void
compound_assignment_multiply_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
@ -89,6 +92,7 @@ compound_assignment_multiply_32 (void)
void
compound_assignment_divide_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200);
@ -105,6 +109,7 @@ compound_assignment_divide_32 (void)
void
compound_assignment_add_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
@ -121,6 +126,7 @@ compound_assignment_add_64 (void)
void
compound_assignment_subtract_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
@ -137,6 +143,7 @@ compound_assignment_subtract_64 (void)
void
compound_assignment_multiply_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
@ -153,6 +160,7 @@ compound_assignment_multiply_64 (void)
void
compound_assignment_divide_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200);
@ -169,6 +177,7 @@ compound_assignment_divide_64 (void)
void
compound_assignment_add_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
@ -185,6 +194,7 @@ compound_assignment_add_128 (void)
void
compound_assignment_subtract_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
@ -201,6 +211,7 @@ compound_assignment_subtract_128 (void)
void
compound_assignment_multiply_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
@ -217,6 +228,7 @@ compound_assignment_multiply_128 (void)
void
compound_assignment_divide_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -39,6 +39,7 @@ unsigned long long ull = 50;
void
compound_assignment_add_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
@ -55,6 +56,7 @@ compound_assignment_add_32 (void)
void
compound_assignment_subtract_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
@ -71,6 +73,7 @@ compound_assignment_subtract_32 (void)
void
compound_assignment_multiply_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
@ -87,6 +90,7 @@ compound_assignment_multiply_32 (void)
void
compound_assignment_divide_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b /= d32; VERIFY (b == 200);
@ -103,6 +107,7 @@ compound_assignment_divide_32 (void)
void
compound_assignment_add_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
@ -119,6 +124,7 @@ compound_assignment_add_64 (void)
void
compound_assignment_subtract_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
@ -135,6 +141,7 @@ compound_assignment_subtract_64 (void)
void
compound_assignment_multiply_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
@ -151,6 +158,7 @@ compound_assignment_multiply_64 (void)
void
compound_assignment_divide_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b /= d32; VERIFY (b == 200);
@ -167,6 +175,7 @@ compound_assignment_divide_64 (void)
void
compound_assignment_add_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
@ -183,6 +192,7 @@ compound_assignment_add_128 (void)
void
compound_assignment_subtract_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
@ -199,6 +209,7 @@ compound_assignment_subtract_128 (void)
void
compound_assignment_multiply_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
@ -215,6 +226,7 @@ compound_assignment_multiply_128 (void)
void
compound_assignment_divide_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b /= d32; VERIFY (b == 200);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -29,6 +29,7 @@ using namespace std::decimal;
void
conversion_from_float_32 ()
{
bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
decimal128 d128(345);
@ -51,6 +52,7 @@ conversion_from_float_32 ()
void
conversion_from_float_64 ()
{
bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
decimal128 d128(345);
@ -73,6 +75,7 @@ conversion_from_float_64 ()
void
conversion_from_float_128 ()
{
bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
decimal128 d128(345);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -29,6 +29,7 @@ using namespace std::decimal;
void
conversion_from_integral_p32 ()
{
bool test __attribute__((unused)) = true;
decimal32 d;
decimal32 from_si (1);
decimal32 from_ui (2U);
@ -61,6 +62,7 @@ conversion_from_integral_p32 ()
void
conversion_from_integral_m32 ()
{
bool test __attribute__((unused)) = true;
decimal32 d;
decimal32 from_si (-1);
decimal32 from_sl (-2L);
@ -81,6 +83,7 @@ conversion_from_integral_m32 ()
void
conversion_from_integral_p64 ()
{
bool test __attribute__((unused)) = true;
decimal64 d;
decimal64 from_si (1);
decimal64 from_ui (2U);
@ -113,6 +116,7 @@ conversion_from_integral_p64 ()
void
conversion_from_integral_m64 ()
{
bool test __attribute__((unused)) = true;
decimal64 d;
decimal64 from_si (-1);
decimal64 from_sl (-2L);
@ -133,6 +137,7 @@ conversion_from_integral_m64 ()
void
conversion_from_integral_p128 ()
{
bool test __attribute__((unused)) = true;
decimal128 d;
decimal128 from_si (1);
decimal128 from_ui (2U);
@ -164,6 +169,7 @@ conversion_from_integral_p128 ()
void
conversion_from_integral_m128 ()
{
bool test __attribute__((unused)) = true;
decimal128 d;
decimal128 from_si (-1);
decimal128 from_sl (-2L);

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -27,7 +27,8 @@ using namespace std::decimal;
void
conversion_to_generic_float_32 ()
{
std::decimal::decimal32 d32(123);
bool test __attribute__((unused)) = true;
decimal32 d32(123);
float f;
double d;
long double ld;
@ -51,7 +52,8 @@ conversion_to_generic_float_32 ()
void
conversion_to_generic_float_64 ()
{
std::decimal::decimal64 d64(234);
bool test __attribute__((unused)) = true;
decimal64 d64(234);
float f;
double d;
long double ld;
@ -75,7 +77,8 @@ conversion_to_generic_float_64 ()
void
conversion_to_generic_float_128 ()
{
std::decimal::decimal128 d128(345);
bool test __attribute__((unused)) = true;
decimal128 d128(345);
float f;
double d;
long double ld;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -23,7 +23,6 @@
#include <decimal/decimal>
#include <climits>
#include <cstdio>
#include <testsuite_hooks.h>
// Use extension to replace implicit long long conversion with function call.
@ -36,6 +35,7 @@ conversion_to_integral_32 (void)
{
#undef MAXVAL
#define MAXVAL 999999LL
bool test __attribute__((unused)) = true;
decimal32 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll;
@ -51,6 +51,7 @@ conversion_to_integral_64 (void)
{
#undef MAXVAL
#define MAXVAL 999999999999999LL
bool test __attribute__((unused)) = true;
decimal64 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll;
@ -66,6 +67,7 @@ conversion_to_integral_128 (void)
{
#undef MAXVAL
#define MAXVAL LONG_LONG_MAX
bool test __attribute__((unused)) = true;
decimal128 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -32,28 +32,31 @@ using namespace std::decimal;
void
ctor_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
float b __attribute__((mode(SD))) = 0.e-101DF;
VERIFY (memcmp (&a, &b, 4) == 0);
VERIFY (std::memcmp (&a, &b, 4) == 0);
}
void
ctor_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
float b __attribute__((mode(DD))) = 0.e-398DD;
VERIFY (memcmp (&a, &b, 8) == 0);
VERIFY (std::memcmp (&a, &b, 8) == 0);
}
void
ctor_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
float b __attribute__((mode(TD))) = 0.e-6176DL;
VERIFY (memcmp (&a, &b, 16) == 0);
VERIFY (std::memcmp (&a, &b, 16) == 0);
}
int

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -34,8 +34,9 @@ using namespace std::decimal;
void
incdec32 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;
@ -81,8 +82,9 @@ incdec32 (void)
void
incdec64 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;
@ -128,8 +130,9 @@ incdec64 (void)
void
incdec128 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -32,8 +32,9 @@ using namespace std::decimal;
void
incdec32 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;
@ -79,8 +80,9 @@ incdec32 (void)
void
incdec64 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;
@ -126,8 +128,9 @@ incdec64 (void)
void
incdec128 (void)
{
bool test __attribute__((unused)) = true;
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.
b = a;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -32,8 +32,8 @@
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));
VERIFY ((std::memcmp ((void *)&x, (void *)&a, SIZE) == 0) \
&& (std::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); \
@ -44,16 +44,17 @@
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));
VERIFY ((std::memcmp ((void *)&x, (void *)&a, SIZE) == 0) \
&& (std::memcmp ((void *)&x, (void *)&b,SIZE) == 0) \
&& (std::memcmp ((void *)&x, (void *)&c,SIZE) == 0) \
&& (std::memcmp ((void *)&x, (void *)&d,SIZE) == 0));
using namespace std::decimal;
void
make_decimal_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a, b, c, d;
float x __attribute__((mode(SD)));
int i;
@ -78,6 +79,7 @@ make_decimal_32 (void)
void
make_decimal_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a, b, c, d;
float x __attribute__((mode(DD)));
int i;
@ -102,6 +104,7 @@ make_decimal_64 (void)
void
make_decimal_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a, b, c, d;
float x __attribute__((mode(TD)));
int i;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -25,7 +25,6 @@
// floating-point type to a generic floating-point type.
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -25,7 +25,6 @@
// generic floating-point type.
#include <decimal/decimal>
#include <testsuite_hooks.h>
using namespace std::decimal;

View File

@ -0,0 +1,71 @@
// 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;
}

View File

@ -0,0 +1,71 @@
// 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;
}

View File

@ -0,0 +1,71 @@
// 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;
}

View File

@ -1,4 +1,4 @@
// 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
// software; you can redistribute it and/or modify it under the
@ -31,6 +31,7 @@ decimal128 a128 (5001), b128 (-5001);
void
unary_plus_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
a = +a32; VERIFY (a == a32);
@ -40,6 +41,7 @@ unary_plus_32 (void)
void
unary_minus_32 (void)
{
bool test __attribute__((unused)) = true;
decimal32 a;
a = -a32; VERIFY (a == b32);
@ -49,6 +51,7 @@ unary_minus_32 (void)
void
unary_plus_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
a = +a64; VERIFY (a == a64);
@ -58,6 +61,7 @@ unary_plus_64 (void)
void
unary_minus_64 (void)
{
bool test __attribute__((unused)) = true;
decimal64 a;
a = -a64; VERIFY (a == b64);
@ -67,6 +71,7 @@ unary_minus_64 (void)
void
unary_plus_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
a = +a128; VERIFY (a == a128);
@ -76,6 +81,7 @@ unary_plus_128 (void)
void
unary_minus_128 (void)
{
bool test __attribute__((unused)) = true;
decimal128 a;
a = -a128; VERIFY (a == b128);