+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:
inline _Tp operator _Op(_Tp __rhs) \
{ \
_Tp __tmp; \
- __tmp.__setval(0 _Op __rhs.__getval()); \
+ __tmp.__setval(_Op __rhs.__getval()); \
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
// software; you can redistribute it and/or modify it under the
void
binary_add_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = si + a; VERIFY (b == 980);
void
binary_subtract_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a - si; VERIFY (b == 1020);
void
binary_multiply_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a * si; VERIFY (b == -20000);
void
binary_divide_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a / si; VERIFY (b == -50);
void
binary_add_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a + si; VERIFY (b == 980);
void
binary_subtract_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a - si; VERIFY (b == 1020);
void
binary_multiply_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a * si; VERIFY (b == -20000);
void
binary_divide_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a / si; VERIFY (b == -50);
void
binary_add_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a + si; VERIFY (b == 980);
void
binary_subtract_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a - si; VERIFY (b == 1020);
void
binary_multiply_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a * si; VERIFY (b == -20000);
void
binary_divide_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
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
// software; you can redistribute it and/or modify it under the
// attempt to do a cast are flagged as errors.
#include <decimal/decimal>
-#include <testsuite_hooks.h>
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
// software; you can redistribute it and/or modify it under the
void
compare_eq_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a == si); VERIFY (si == a);
void
compare_ne_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a = 100;
VERIFY (a != si); VERIFY (si != a);
void
compare_lt_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a = -100;
VERIFY (a < si);
void
compare_le_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
void
compare_gt_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a = 100;
VERIFY (a > si);
void
compare_ge_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a;
a = si; VERIFY (a >= si); VERIFY (si <= a);
void
compare_eq_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a == si); VERIFY (si == a);
void
compare_ne_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a = 100;
VERIFY (a != si); VERIFY (si != a);
void
compare_lt_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a = -100;
VERIFY (a < si);
void
compare_le_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
void
compare_gt_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a = 100;
VERIFY (a > si);
void
compare_ge_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a;
a = si; VERIFY (a >= si); VERIFY (si <= a);
void
compare_eq_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a;
a = si; VERIFY (a == si); VERIFY (si == a);
void
compare_ne_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a = 100;
VERIFY (a != si); VERIFY (si != a);
void
compare_lt_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a = -100;
VERIFY (a < si);
void
compare_le_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a;
a = si; VERIFY (a <= si); VERIFY (si <= a);
void
compare_gt_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a = 100;
VERIFY (a > si);
void
compare_ge_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 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
// software; you can redistribute it and/or modify it under the
void
compound_assignment_add_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
void
compound_assignment_subtract_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
void
compound_assignment_multiply_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
void
compound_assignment_divide_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200);
void
compound_assignment_add_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
void
compound_assignment_subtract_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
void
compound_assignment_multiply_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
void
compound_assignment_divide_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b.operator/=(d32); VERIFY (b == 200);
void
compound_assignment_add_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator+=(d32); VERIFY (b == 1005);
void
compound_assignment_subtract_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator-=(d32); VERIFY (b == 995);
void
compound_assignment_multiply_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b.operator*=(d32); VERIFY (b == 5000);
void
compound_assignment_divide_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
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
// software; you can redistribute it and/or modify it under the
void
compound_assignment_add_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
void
compound_assignment_subtract_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
void
compound_assignment_multiply_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
void
compound_assignment_divide_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a (1000), b;
b = a; b /= d32; VERIFY (b == 200);
void
compound_assignment_add_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
void
compound_assignment_subtract_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
void
compound_assignment_multiply_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
void
compound_assignment_divide_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a (1000), b;
b = a; b /= d32; VERIFY (b == 200);
void
compound_assignment_add_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b += d32; VERIFY (b == 1005);
void
compound_assignment_subtract_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b -= d32; VERIFY (b == 995);
void
compound_assignment_multiply_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
b = a; b *= d32; VERIFY (b == 5000);
void
compound_assignment_divide_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a (1000), b;
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
// software; you can redistribute it and/or modify it under the
void
conversion_from_float_32 ()
{
+ bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
decimal128 d128(345);
void
conversion_from_float_64 ()
{
+ bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
decimal128 d128(345);
void
conversion_from_float_128 ()
{
+ bool test __attribute__((unused)) = true;
decimal32 d32(123);
decimal64 d64(234);
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
// software; you can redistribute it and/or modify it under the
void
conversion_from_integral_p32 ()
{
+ bool test __attribute__((unused)) = true;
decimal32 d;
decimal32 from_si (1);
decimal32 from_ui (2U);
void
conversion_from_integral_m32 ()
{
+ bool test __attribute__((unused)) = true;
decimal32 d;
decimal32 from_si (-1);
decimal32 from_sl (-2L);
void
conversion_from_integral_p64 ()
{
+ bool test __attribute__((unused)) = true;
decimal64 d;
decimal64 from_si (1);
decimal64 from_ui (2U);
void
conversion_from_integral_m64 ()
{
+ bool test __attribute__((unused)) = true;
decimal64 d;
decimal64 from_si (-1);
decimal64 from_sl (-2L);
void
conversion_from_integral_p128 ()
{
+ bool test __attribute__((unused)) = true;
decimal128 d;
decimal128 from_si (1);
decimal128 from_ui (2U);
void
conversion_from_integral_m128 ()
{
+ bool test __attribute__((unused)) = true;
decimal128 d;
decimal128 from_si (-1);
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
// software; you can redistribute it and/or modify it under the
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;
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;
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;
-// 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
#include <decimal/decimal>
#include <climits>
-#include <cstdio>
#include <testsuite_hooks.h>
// Use extension to replace implicit long long conversion with function call.
{
#undef MAXVAL
#define MAXVAL 999999LL
+ bool test __attribute__((unused)) = true;
decimal32 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll;
{
#undef MAXVAL
#define MAXVAL 999999999999999LL
+ bool test __attribute__((unused)) = true;
decimal64 a, b (1), c (-1), d (MAXVAL), e (-MAXVAL);
long long ll;
{
#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;
-// 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
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
-// 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
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;
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;
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;
-// 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
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;
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;
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;
-// 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
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); \
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;
void
make_decimal_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a, b, c, d;
float x __attribute__((mode(DD)));
int i;
void
make_decimal_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a, b, c, d;
float x __attribute__((mode(TD)));
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
// software; you can redistribute it and/or modify it under the
// floating-point type to a generic floating-point type.
#include <decimal/decimal>
-#include <testsuite_hooks.h>
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
// software; you can redistribute it and/or modify it under the
// generic floating-point type.
#include <decimal/decimal>
-#include <testsuite_hooks.h>
using namespace std::decimal;
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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
// software; you can redistribute it and/or modify it under the
void
unary_plus_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a;
a = +a32; VERIFY (a == a32);
void
unary_minus_32 (void)
{
+ bool test __attribute__((unused)) = true;
decimal32 a;
a = -a32; VERIFY (a == b32);
void
unary_plus_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a;
a = +a64; VERIFY (a == a64);
void
unary_minus_64 (void)
{
+ bool test __attribute__((unused)) = true;
decimal64 a;
a = -a64; VERIFY (a == b64);
void
unary_plus_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a;
a = +a128; VERIFY (a == a128);
void
unary_minus_128 (void)
{
+ bool test __attribute__((unused)) = true;
decimal128 a;
a = -a128; VERIFY (a == b128);