Commit 1d5ba98c by Janis Johnson Committed by Janis Johnson

dfp.exp: Use appropriate default options.

	* gcc.dg/dfp/dfp.exp: Use appropriate default options.
	* gcc.dg/dfp/dfp-dbg.h: New; define FAILURE, FINISH.
	* gcc.dg/dfp/cast-bad.c: Use default options.
	* gcc.dg/dfp/compare-rel-const.c: Ditto.
	* gcc.dg/dfp/composite-type.c: Ditto.
	* gcc.dg/dfp/constants.c: Ditto.
	* gcc.dg/dfp/constants-hex.c: Ditto.
	* gcc.dg/dfp/constants-pedantic.c: Ditto.
	* gcc.dg/dfp/convert-bfp-fold.c: Ditto.
	* gcc.dg/dfp/convert-dfp-fold.c: Ditto.
	* gcc.dg/dfp/convert-int-max-fold.c: Ditto.
	* gcc.dg/dfp/ctypes.c: Ditto.
	* gcc.dg/dfp/ddmode-ice.c: Ditto.
	* gcc.dg/dfp/dec-eval-method-2.c: Ditto.
	* gcc.dg/dfp/float-constant-double.c: Ditto.
	* gcc.dg/dfp/keywords-pedantic.c: Ditto.
	* gcc.dg/dfp/keywords-reserved.c: Ditto.
	* gcc.dg/dfp/modes.c: Ditto.
	* gcc.dg/dfp/operator-bitwise.c: Ditto.
	* gcc.dg/dfp/pr31344.c: Ditto.
	* gcc.dg/dfp/pr31385.c: Ditto.
	* gcc.dg/dfp/pr33466.c: Ditto.
	* gcc.dg/dfp/pr35620.c: Ditto.
	* gcc.dg/dfp/pr37435.c: Ditto.
	* gcc.dg/dfp/pr39986.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-1.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-2.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-3.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-4.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-7.c: Ditto.
	* gcc.dg/dfp/pragma-float-const-decimal64-8.c: Ditto.
	* gcc.dg/dfp/typespec.c: Ditto.
	* gcc.dg/dfp/usual-arith-conv-bad.c: Ditto.
	* gcc.dg/dfp/usual-arith-conv-bad-2.c: Ditto.
	* gcc.dg/dfp/usual-arith-conv-const.c: Ditto.
	* gcc.dg/dfp/Wbad-function-cast-1.c: Ditto.
	* gcc.dg/dfp/Wtraditional-conversion-2.c: Ditto.
	* gcc.dg/dfp/wtr-conversion-1.c: Ditto.
	* gcc.dg/dfp/compare-eq.h: Define custom debug macros.
	* gcc.dg/dfp/compare-rel.h: Ditto.
	* gcc.dg/dfp/compare-special.h: Ditto.
	* gcc.dg/dfp/convert.h: Ditto.
	* gcc.dg/dfp/fe-check.h: Ditto.
	* gcc.dg/dfp/call-by-value.c: Use default options and
	  debug macros.
	* gcc.dg/dfp/cast.c: Ditto.
	* gcc.dg/dfp/compare-eq-const.c: Ditto.
	* gcc.dg/dfp/compare-eq-d32.c: Ditto.
	* gcc.dg/dfp/compare-eq-d64.c: Ditto.
	* gcc.dg/dfp/compare-eq-d128.c: Ditto.
	* gcc.dg/dfp/compare-eq-dfp.c: Ditto.
	* gcc.dg/dfp/compare-rel-d32.c: Ditto.
	* gcc.dg/dfp/compare-rel-d64.c: Ditto.
	* gcc.dg/dfp/compare-rel-d128.c: Ditto.
	* gcc.dg/dfp/compare-rel-dfp.c: Ditto.
	* gcc.dg/dfp/compare-special-d32.c: Ditto.
	* gcc.dg/dfp/compare-special-d64.c: Ditto.
	* gcc.dg/dfp/compare-special-d128.c: Ditto.
	* gcc.dg/dfp/constants-zero.c: Ditto.
	* gcc.dg/dfp/convert-bfp-2.c: Ditto.
	* gcc.dg/dfp/convert-bfp-3.c: Ditto.
	* gcc.dg/dfp/convert-bfp-4.c: Ditto.
	* gcc.dg/dfp/convert-bfp-5.c: Ditto.
	* gcc.dg/dfp/convert-bfp-6.c: Ditto.
	* gcc.dg/dfp/convert-bfp-7.c: Ditto.
	* gcc.dg/dfp/convert-bfp-8.c: Ditto.
	* gcc.dg/dfp/convert-bfp-9.c: Ditto.
	* gcc.dg/dfp/convert-bfp-10.c: Ditto.
	* gcc.dg/dfp/convert-bfp-11.c: Ditto.
	* gcc.dg/dfp/convert-bfp-12.c: Ditto.
	* gcc.dg/dfp/convert-bfp-13.c: Ditto.
	* gcc.dg/dfp/convert-bfp-14.c: Ditto.
	* gcc.dg/dfp/convert-bfp.c: Ditto.
	* gcc.dg/dfp/convert-complex.c: Ditto.
	* gcc.dg/dfp/convert-dfp.c: Ditto.
	* gcc.dg/dfp/convert-dfp-fold-2.c: Ditto.
	* gcc.dg/dfp/convert-dfp-round.c: Ditto.
	* gcc.dg/dfp/convert-int.c: Ditto.
	* gcc.dg/dfp/convert-int-fold.c: Ditto.
	* gcc.dg/dfp/convert-int-max.c: Ditto.
	* gcc.dg/dfp/convert-int-saturate.c: Ditto.
	* gcc.dg/dfp/decfloat-constants.c: Ditto.
	* gcc.dg/dfp/fe-binop.c: Ditto.
	* gcc.dg/dfp/fe-convert-1.c: Ditto.
	* gcc.dg/dfp/fe-convert-2.c: Ditto.
	* gcc.dg/dfp/fe-convert-3.c: Ditto.
	* gcc.dg/dfp/func-array.c: Ditto.
	* gcc.dg/dfp/func-deref.c: Ditto.
	* gcc.dg/dfp/func-mixed.c: Ditto.
	* gcc.dg/dfp/func-pointer.c: Ditto.
	* gcc.dg/dfp/func-scalar.c: Ditto.
	* gcc.dg/dfp/func-struct.c: Ditto.
	* gcc.dg/dfp/func-vararg-alternate.h: Ditto.
	* gcc.dg/dfp/func-vararg-alternate-d32.c: Ditto.
	* gcc.dg/dfp/func-vararg-alternate-d64.c: Ditto.
	* gcc.dg/dfp/func-vararg-alternate-d128.c: Ditto.
	* gcc.dg/dfp/func-vararg-alternate-d128-2.c: Ditto.
	* gcc.dg/dfp/func-vararg-dfp.c: Ditto.
	* gcc.dg/dfp/func-vararg-mixed.c: Ditto.
	* gcc.dg/dfp/func-vararg-mixed-2.c: Ditto.
	* gcc.dg/dfp/func-vararg-size0.c: Ditto.
	* gcc.dg/dfp/inf-1.c: Ditto.
	* gcc.dg/dfp/loop-index.c: Ditto.
	* gcc.dg/dfp/nan-1.c: Ditto.
	* gcc.dg/dfp/nan-2.c: Ditto.
	* gcc.dg/dfp/operator-arith-fold.c: Ditto.
	* gcc.dg/dfp/operator-assignment.c: Ditto.
	* gcc.dg/dfp/operator-comma.c: Ditto.
	* gcc.dg/dfp/operator-cond.c: Ditto.
	* gcc.dg/dfp/operator-logical.c: Ditto.
	* gcc.dg/dfp/operator-unary.c: Ditto.
	* gcc.dg/dfp/pr36800.c: Ditto.
	* gcc.dg/dfp/pr39034.c: Ditto.
	* gcc.dg/dfp/pr39035.c: Ditto.
	* gcc.dg/dfp/pr39902.c: Ditto.
	* gcc.dg/dfp/signbit-1.c: Ditto.
	* gcc.dg/dfp/signbit-2.c: Ditto.
	* gcc.dg/dfp/struct-layout-1.c: Ditto.
	* gcc.dg/dfp/union-init.c: Ditto.
	* gcc.dg/dfp/usual-arith-conv.c: Ditto.

From-SVN: r151764
parent fe663f4e
2009-09-16 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/dfp/dfp.exp: Use appropriate default options.
* gcc.dg/dfp/dfp-dbg.h: New; define FAILURE, FINISH.
* gcc.dg/dfp/cast-bad.c: Use default options.
* gcc.dg/dfp/compare-rel-const.c: Ditto.
* gcc.dg/dfp/composite-type.c: Ditto.
* gcc.dg/dfp/constants.c: Ditto.
* gcc.dg/dfp/constants-hex.c: Ditto.
* gcc.dg/dfp/constants-pedantic.c: Ditto.
* gcc.dg/dfp/convert-bfp-fold.c: Ditto.
* gcc.dg/dfp/convert-dfp-fold.c: Ditto.
* gcc.dg/dfp/convert-int-max-fold.c: Ditto.
* gcc.dg/dfp/ctypes.c: Ditto.
* gcc.dg/dfp/ddmode-ice.c: Ditto.
* gcc.dg/dfp/dec-eval-method-2.c: Ditto.
* gcc.dg/dfp/float-constant-double.c: Ditto.
* gcc.dg/dfp/keywords-pedantic.c: Ditto.
* gcc.dg/dfp/keywords-reserved.c: Ditto.
* gcc.dg/dfp/modes.c: Ditto.
* gcc.dg/dfp/operator-bitwise.c: Ditto.
* gcc.dg/dfp/pr31344.c: Ditto.
* gcc.dg/dfp/pr31385.c: Ditto.
* gcc.dg/dfp/pr33466.c: Ditto.
* gcc.dg/dfp/pr35620.c: Ditto.
* gcc.dg/dfp/pr37435.c: Ditto.
* gcc.dg/dfp/pr39986.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-1.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-2.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-3.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-4.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-7.c: Ditto.
* gcc.dg/dfp/pragma-float-const-decimal64-8.c: Ditto.
* gcc.dg/dfp/typespec.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-bad.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-bad-2.c: Ditto.
* gcc.dg/dfp/usual-arith-conv-const.c: Ditto.
* gcc.dg/dfp/Wbad-function-cast-1.c: Ditto.
* gcc.dg/dfp/Wtraditional-conversion-2.c: Ditto.
* gcc.dg/dfp/wtr-conversion-1.c: Ditto.
* gcc.dg/dfp/compare-eq.h: Define custom debug macros.
* gcc.dg/dfp/compare-rel.h: Ditto.
* gcc.dg/dfp/compare-special.h: Ditto.
* gcc.dg/dfp/convert.h: Ditto.
* gcc.dg/dfp/fe-check.h: Ditto.
* gcc.dg/dfp/call-by-value.c: Use default options and
debug macros.
* gcc.dg/dfp/cast.c: Ditto.
* gcc.dg/dfp/compare-eq-const.c: Ditto.
* gcc.dg/dfp/compare-eq-d32.c: Ditto.
* gcc.dg/dfp/compare-eq-d64.c: Ditto.
* gcc.dg/dfp/compare-eq-d128.c: Ditto.
* gcc.dg/dfp/compare-eq-dfp.c: Ditto.
* gcc.dg/dfp/compare-rel-d32.c: Ditto.
* gcc.dg/dfp/compare-rel-d64.c: Ditto.
* gcc.dg/dfp/compare-rel-d128.c: Ditto.
* gcc.dg/dfp/compare-rel-dfp.c: Ditto.
* gcc.dg/dfp/compare-special-d32.c: Ditto.
* gcc.dg/dfp/compare-special-d64.c: Ditto.
* gcc.dg/dfp/compare-special-d128.c: Ditto.
* gcc.dg/dfp/constants-zero.c: Ditto.
* gcc.dg/dfp/convert-bfp-2.c: Ditto.
* gcc.dg/dfp/convert-bfp-3.c: Ditto.
* gcc.dg/dfp/convert-bfp-4.c: Ditto.
* gcc.dg/dfp/convert-bfp-5.c: Ditto.
* gcc.dg/dfp/convert-bfp-6.c: Ditto.
* gcc.dg/dfp/convert-bfp-7.c: Ditto.
* gcc.dg/dfp/convert-bfp-8.c: Ditto.
* gcc.dg/dfp/convert-bfp-9.c: Ditto.
* gcc.dg/dfp/convert-bfp-10.c: Ditto.
* gcc.dg/dfp/convert-bfp-11.c: Ditto.
* gcc.dg/dfp/convert-bfp-12.c: Ditto.
* gcc.dg/dfp/convert-bfp-13.c: Ditto.
* gcc.dg/dfp/convert-bfp-14.c: Ditto.
* gcc.dg/dfp/convert-bfp.c: Ditto.
* gcc.dg/dfp/convert-complex.c: Ditto.
* gcc.dg/dfp/convert-dfp.c: Ditto.
* gcc.dg/dfp/convert-dfp-fold-2.c: Ditto.
* gcc.dg/dfp/convert-dfp-round.c: Ditto.
* gcc.dg/dfp/convert-int.c: Ditto.
* gcc.dg/dfp/convert-int-fold.c: Ditto.
* gcc.dg/dfp/convert-int-max.c: Ditto.
* gcc.dg/dfp/convert-int-saturate.c: Ditto.
* gcc.dg/dfp/decfloat-constants.c: Ditto.
* gcc.dg/dfp/fe-binop.c: Ditto.
* gcc.dg/dfp/fe-convert-1.c: Ditto.
* gcc.dg/dfp/fe-convert-2.c: Ditto.
* gcc.dg/dfp/fe-convert-3.c: Ditto.
* gcc.dg/dfp/func-array.c: Ditto.
* gcc.dg/dfp/func-deref.c: Ditto.
* gcc.dg/dfp/func-mixed.c: Ditto.
* gcc.dg/dfp/func-pointer.c: Ditto.
* gcc.dg/dfp/func-scalar.c: Ditto.
* gcc.dg/dfp/func-struct.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate.h: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d32.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d64.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d128.c: Ditto.
* gcc.dg/dfp/func-vararg-alternate-d128-2.c: Ditto.
* gcc.dg/dfp/func-vararg-dfp.c: Ditto.
* gcc.dg/dfp/func-vararg-mixed.c: Ditto.
* gcc.dg/dfp/func-vararg-mixed-2.c: Ditto.
* gcc.dg/dfp/func-vararg-size0.c: Ditto.
* gcc.dg/dfp/inf-1.c: Ditto.
* gcc.dg/dfp/loop-index.c: Ditto.
* gcc.dg/dfp/nan-1.c: Ditto.
* gcc.dg/dfp/nan-2.c: Ditto.
* gcc.dg/dfp/operator-arith-fold.c: Ditto.
* gcc.dg/dfp/operator-assignment.c: Ditto.
* gcc.dg/dfp/operator-comma.c: Ditto.
* gcc.dg/dfp/operator-cond.c: Ditto.
* gcc.dg/dfp/operator-logical.c: Ditto.
* gcc.dg/dfp/operator-unary.c: Ditto.
* gcc.dg/dfp/pr36800.c: Ditto.
* gcc.dg/dfp/pr39034.c: Ditto.
* gcc.dg/dfp/pr39035.c: Ditto.
* gcc.dg/dfp/pr39902.c: Ditto.
* gcc.dg/dfp/signbit-1.c: Ditto.
* gcc.dg/dfp/signbit-2.c: Ditto.
* gcc.dg/dfp/struct-layout-1.c: Ditto.
* gcc.dg/dfp/union-init.c: Ditto.
* gcc.dg/dfp/usual-arith-conv.c: Ditto.
2009-09-16 Michael Matz <matz@suse.de> 2009-09-16 Michael Matz <matz@suse.de>
PR fortran/41212 PR fortran/41212
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* Based on gcc.dg/Wbad-function-cast-1.c. */ /* Based on gcc.dg/Wbad-function-cast-1.c. */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wbad-function-cast" } */ /* { dg-options "-Wbad-function-cast" } */
int if1(void); int if1(void);
char if2(void); char if2(void);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
(based on gcc.dg/Wtraditional-conversion-2.c). */ (based on gcc.dg/Wtraditional-conversion-2.c). */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wtraditional-conversion" } */ /* { dg-options "-Wtraditional-conversion" } */
void fsi(signed int); void fsi(signed int);
void fd32(_Decimal32); void fd32(_Decimal32);
......
/* { dg-options "-std=gnu99" } */
/* C99 6.9.1(9) Function definitions; parameter has automatic storage. /* C99 6.9.1(9) Function definitions; parameter has automatic storage.
Test that actual parameters are passed by value and that modifications Test that actual parameters are passed by value and that modifications
made within functions are lost on function return. */ made within functions are lost on function return. */
extern void abort (void); #include "dfp-dbg.h"
int foo32 (_Decimal32 z) int foo32 (_Decimal32 z)
{ {
...@@ -31,15 +29,15 @@ main () ...@@ -31,15 +29,15 @@ main ()
foo32 (d32); foo32 (d32);
if (d32 != 1.1df) if (d32 != 1.1df)
abort (); FAILURE
foo64 (d64); foo64 (d64);
if (d64 != 1.2dd) if (d64 != 1.2dd)
abort (); FAILURE
foo128 (d128); foo128 (d128);
if (d128 != 1.3dl) if (d128 != 1.3dl)
abort (); FAILURE
return 0; FINISH
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* C99 6.5.4 Cast operators. /* C99 6.5.4 Cast operators.
Test invalid casts involving decimal float. */ Test invalid casts involving decimal float. */
......
/* { dg-options "-std=gnu99" } */
/* C99 6.5.4 Cast operators. /* C99 6.5.4 Cast operators.
Test valid casts involving decimal float. */ Test valid casts involving decimal float. */
extern void abort (void); #include "dfp-dbg.h"
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -81,8 +71,5 @@ main (void) ...@@ -81,8 +71,5 @@ main (void)
if (d128 != (_Decimal128) d) if (d128 != (_Decimal128) d)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.9 Equality operators. /* C99 6.5.9 Equality operators.
Compare decimal float constants against each other. */ Compare decimal float constants against each other. */
#include "dfp-dbg.h"
extern void link_error (void); extern void link_error (void);
int int
...@@ -24,5 +24,5 @@ main () ...@@ -24,5 +24,5 @@ main ()
if (1.4dd + 1.4dd + 1.4dd != 4.2dd) if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
link_error (); link_error ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators. /* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
int main () int main ()
{ {
test_compares (); test_compares ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators. /* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
int main () int main ()
{ {
test_compares (); test_compares ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators. /* C99 6.5.9 Equality operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
int main () int main ()
{ {
test_compares (); test_compares ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.9 Equality operators. /* C99 6.5.9 Equality operators.
Compare decimal float values against variables of different types. */ Compare decimal float values against variables of different types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -59,7 +49,5 @@ main () ...@@ -59,7 +49,5 @@ main ()
compare_dfp (); compare_dfp ();
if (failcnt) FINISH
abort ();
return 0;
} }
...@@ -2,19 +2,18 @@ ...@@ -2,19 +2,18 @@
are not affected by rounding. */ are not affected by rounding. */
#include <stdlib.h> #include <stdlib.h>
#include "dfp-dbg.h"
static int failcnt;
#define PASTE2(A,B) A ## B #define PASTE2(A,B) A ## B
#define PASTE(A,B) PASTE2(A,B) #define PASTE(A,B) PASTE2(A,B)
#undef FAILURE
#ifdef DBG #ifdef DBG
#include <stdio.h>
#define FAILURE(OP,KIND) \ #define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
failcnt++; } failures++; }
#else #else
#define FAILURE(OP,KIND) abort (); #define FAILURE(OP,KIND) __builtin_abort ();
#endif #endif
#ifndef WIDTH #ifndef WIDTH
...@@ -90,7 +89,4 @@ test_compares (void) ...@@ -90,7 +89,4 @@ test_compares (void)
if (! (x != zero)) FAILURE ("!=", "greater") if (! (x != zero)) FAILURE ("!=", "greater")
if (! (y != m_one)) FAILURE ("!=", "greater") if (! (y != m_one)) FAILURE ("!=", "greater")
if (! (z != m_two)) FAILURE ("!=", "greater") if (! (z != m_two)) FAILURE ("!=", "greater")
if (failcnt)
abort ();
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
Compare decimal float constants against each other. */ Compare decimal float constants against each other. */
......
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -10,5 +10,5 @@ int ...@@ -10,5 +10,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -10,5 +10,5 @@ int ...@@ -10,5 +10,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
Compare decimal float values against each other at runtime. */ Compare decimal float values against each other at runtime. */
...@@ -10,5 +10,5 @@ int ...@@ -10,5 +10,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
Compare decimal float values against variables of different types. */ Compare decimal float values against variables of different types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -59,7 +49,5 @@ main () ...@@ -59,7 +49,5 @@ main ()
compare_dfp (); compare_dfp ();
if (failcnt) FINISH
abort ();
return 0;
} }
...@@ -2,21 +2,20 @@ ...@@ -2,21 +2,20 @@
are not affected by rounding. */ are not affected by rounding. */
#include <stdlib.h> #include <stdlib.h>
#include "dfp-dbg.h"
static int failcnt; #undef FAILURE
#define PASTE2(A,B) A ## B
#define PASTE(A,B) PASTE2(A,B)
#ifdef DBG #ifdef DBG
#include <stdio.h>
#define FAILURE(OP,KIND) \ #define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
failcnt++; } failures++; }
#else #else
#define FAILURE(OP,KIND) abort (); #define FAILURE(OP,KIND) __builtin_abort ();
#endif #endif
#define PASTE2(A,B) A ## B
#define PASTE(A,B) PASTE2(A,B)
#ifndef WIDTH #ifndef WIDTH
#error define WIDTH as decimal float size in bytes #error define WIDTH as decimal float size in bytes
#endif #endif
...@@ -130,7 +129,4 @@ test_compares (void) ...@@ -130,7 +129,4 @@ test_compares (void)
if (y > one) FAILURE (">", "greater") if (y > one) FAILURE (">", "greater")
if (z > zero) FAILURE (">", "greater") if (z > zero) FAILURE (">", "greater")
if (z > one) FAILURE (">", "greater") if (z > one) FAILURE (">", "greater")
if (failcnt)
abort ();
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators. C99 6.5.9 Equality operators.
...@@ -11,5 +11,5 @@ int ...@@ -11,5 +11,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators. C99 6.5.9 Equality operators.
...@@ -11,5 +11,5 @@ int ...@@ -11,5 +11,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.8 Relational operators. /* C99 6.5.8 Relational operators.
C99 6.5.9 Equality operators. C99 6.5.9 Equality operators.
...@@ -11,5 +11,5 @@ int ...@@ -11,5 +11,5 @@ int
main () main ()
{ {
test_compares (); test_compares ();
return 0; FINISH
} }
/* Basic test of runtime relational comparisons using NaNs and infinities. */ /* Basic test of runtime relational comparisons using NaNs and infinities. */
#include <stdlib.h> #include <stdlib.h>
#include "dfp-dbg.h"
static int failcnt;
#define PASTE2(A,B) A ## B #define PASTE2(A,B) A ## B
#define PASTE(A,B) PASTE2(A,B) #define PASTE(A,B) PASTE2(A,B)
/* Override FAILURE from dfp-dbg.h with one that provides additional info. */
#undef FAILURE
#ifdef DBG #ifdef DBG
#include <stdio.h>
#define FAILURE(OP,KIND) \ #define FAILURE(OP,KIND) \
{ printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \
failcnt++; } failures++; }
#else #else
#define FAILURE(OP,KIND) abort (); #define FAILURE(OP,KIND) __builtin_abort ();
#endif #endif
#ifndef WIDTH #ifndef WIDTH
...@@ -281,7 +281,4 @@ test_compares (void) ...@@ -281,7 +281,4 @@ test_compares (void)
if (!(y != m_inf)) FAILURE ("!=", "inf") if (!(y != m_inf)) FAILURE ("!=", "inf")
if (!(z != inf)) FAILURE ("!=", "inf") if (!(z != inf)) FAILURE ("!=", "inf")
if (z != m_inf) FAILURE ("!=", "inf") if (z != m_inf) FAILURE ("!=", "inf")
if (failcnt)
abort ();
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -O -Wall" } */ /* { dg-options "-O -Wall" } */
/* C99 6.2.7: Compatible type and composite type. */ /* C99 6.2.7: Compatible type and composite type. */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* N1150 6: Constants. /* N1150 6: Constants.
C99 6.4.4.2: Floating constants. C99 6.4.4.2: Floating constants.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -pedantic" } */ /* { dg-options "-pedantic" } */
/* N1150 6: Constants. /* N1150 6: Constants.
C99 6.4.4.2: Floating constants. */ C99 6.4.4.2: Floating constants. */
#include "dfp-dbg.h"
_Decimal32 a = 1.1df; /* { dg-warning "GCC extension|ISO C" } */ _Decimal32 a = 1.1df; /* { dg-warning "GCC extension|ISO C" } */
_Decimal32 b = -.003DF; /* { dg-warning "GCC extension|ISO C" } */ _Decimal32 b = -.003DF; /* { dg-warning "GCC extension|ISO C" } */
_Decimal64 c = 11e-1dl; /* { dg-warning "GCC extension|ISO C" } */ _Decimal64 c = 11e-1dl; /* { dg-warning "GCC extension|ISO C" } */
......
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* Decimal float values can have significant trailing zeroes. This is /* Decimal float values can have significant trailing zeroes. This is
true for zero values as well. Check that various representations of true for zero values as well. Check that various representations of
zero are handled correctly when specified as literal constants. */ zero are handled correctly when specified as literal constants. */
extern void abort (void); #include "dfp-dbg.h"
int big_endian; int big_endian;
...@@ -58,74 +58,74 @@ void ...@@ -58,74 +58,74 @@ void
dpd_tests (void) dpd_tests (void)
{ {
if (! compare32 (0.DF, 0x22500000U)) if (! compare32 (0.DF, 0x22500000U))
abort (); FAILURE
if (! compare32 (-0.DF, 0xa2500000U)) if (! compare32 (-0.DF, 0xa2500000U))
abort (); FAILURE
if (! compare32 (0.E-4DF, 0x22100000U)) if (! compare32 (0.E-4DF, 0x22100000U))
abort (); FAILURE
if (! compare32 (0.E-7DF, 0x21e00000U)) if (! compare32 (0.E-7DF, 0x21e00000U))
abort (); FAILURE
if (! compare32 (0.E+3DF, 0x22800000U)) if (! compare32 (0.E+3DF, 0x22800000U))
abort (); FAILURE
if (! compare64 (0.DD, 0x2238000000000000ULL)) if (! compare64 (0.DD, 0x2238000000000000ULL))
abort (); FAILURE
if (! compare64 (-0.DD, 0xa238000000000000ULL)) if (! compare64 (-0.DD, 0xa238000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E-6DD, 0x2220000000000000ULL)) if (! compare64 (0.E-6DD, 0x2220000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E-7DD, 0x221c000000000000ULL)) if (! compare64 (0.E-7DD, 0x221c000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E+2DD, 0x2240000000000000ULL)) if (! compare64 (0.E+2DD, 0x2240000000000000ULL))
abort (); FAILURE
if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.DL, 0x2208000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (-0.DL, 0xa208000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E-3DL, 0x2207400000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E-8DL, 0x2206000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E+2DL, 0x2208800000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
} }
void void
bid_tests (void) bid_tests (void)
{ {
if (! compare32 (0.DF, 0x32800000U)) if (! compare32 (0.DF, 0x32800000U))
abort (); FAILURE
if (! compare32 (-0.DF, 0xb2800000U)) if (! compare32 (-0.DF, 0xb2800000U))
abort (); FAILURE
if (! compare32 (0.E-4DF, 0x30800000U)) if (! compare32 (0.E-4DF, 0x30800000U))
abort (); FAILURE
if (! compare32 (0.E-7DF, 0x2f000000U)) if (! compare32 (0.E-7DF, 0x2f000000U))
abort (); FAILURE
if (! compare32 (0.E+3DF, 0x34000000U)) if (! compare32 (0.E+3DF, 0x34000000U))
abort (); FAILURE
if (! compare64 (0.DD, 0x31c0000000000000ULL)) if (! compare64 (0.DD, 0x31c0000000000000ULL))
abort (); FAILURE
if (! compare64 (-0.DD, 0xb1c0000000000000ULL)) if (! compare64 (-0.DD, 0xb1c0000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E-6DD, 0x3100000000000000ULL)) if (! compare64 (0.E-6DD, 0x3100000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E-7DD, 0x30e0000000000000ULL)) if (! compare64 (0.E-7DD, 0x30e0000000000000ULL))
abort (); FAILURE
if (! compare64 (0.E+2DD, 0x3200000000000000ULL)) if (! compare64 (0.E+2DD, 0x3200000000000000ULL))
abort (); FAILURE
if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.DL, 0x3040000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (-0.DL, 0xb040000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E-3DL, 0x303a000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E-8DL, 0x3030000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL)) if (! compare128 (0.E+2DL, 0x3044000000000000ULL, 0x0000000000000000ULL))
abort (); FAILURE
} }
int int
...@@ -138,7 +138,7 @@ main () ...@@ -138,7 +138,7 @@ main ()
if ((sizeof (_Decimal64) != sizeof (long long)) if ((sizeof (_Decimal64) != sizeof (long long))
|| (sizeof (_Decimal128) != 2 * sizeof (long long)) || (sizeof (_Decimal128) != 2 * sizeof (long long))
|| (sizeof (_Decimal32) != sizeof (_Decimal32))) || (sizeof (_Decimal32) != sizeof (_Decimal32)))
abort (); FAILURE
u32.d = 1.DF; u32.d = 1.DF;
...@@ -153,7 +153,7 @@ main () ...@@ -153,7 +153,7 @@ main ()
bid_tests (); bid_tests ();
} }
else else
abort (); /* unknown format; test problem */ FAILURE /* unknown format; test problem */
return 0; FINISH
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* N1150 6: Constants. /* N1150 6: Constants.
C99 6.4.4.2: Floating constants. */ C99 6.4.4.2: Floating constants. */
......
/* { dg-options "-std=gnu99" } */
/* This test assumes IEEE float and double. */ /* This test assumes IEEE float and double. */
#define __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__
...@@ -108,7 +106,5 @@ main () ...@@ -108,7 +106,5 @@ main ()
convert_246 (); convert_246 ();
convert_247 (); convert_247 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */ /* { dg-skip-if "" { ! "powerpc*-*-linux*" } { "*" } { "" } } */
/* Test decimal float conversions to and from IBM 128-bit long double. /* Test decimal float conversions to and from IBM 128-bit long double.
...@@ -55,7 +54,5 @@ main () ...@@ -55,7 +54,5 @@ main ()
convert_311 (); convert_311 ();
convert_312 (); convert_312 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* Test for bug where fold wrongly removed conversions to double and /* Test for bug where fold wrongly removed conversions to double and
replaced them by conversions to float. */ replaced them by conversions to float. */
/* { dg-options "-std=gnu99" } */
extern void abort (void); #include "dfp-dbg.h"
extern void exit (int);
volatile float f = __builtin_inff (); volatile float f = __builtin_inff ();
volatile _Decimal32 d32 = 1e40DF; volatile _Decimal32 d32 = 1e40DF;
...@@ -12,6 +10,7 @@ int ...@@ -12,6 +10,7 @@ int
main (void) main (void)
{ {
if ((double) f == (double) d32) if ((double) f == (double) d32)
abort (); FAILURE
exit (0);
FINISH
} }
/* Test for bug where fold changed binary operation to decimal /* Test for bug where fold changed binary operation to decimal
depending on typedefs. */ depending on typedefs. */
/* { dg-options "-std=gnu99" } */
extern void abort (void); #include "dfp-dbg.h"
extern void exit (int);
volatile double d = 1.2345675; volatile double d = 1.2345675;
...@@ -15,6 +13,6 @@ main (void) ...@@ -15,6 +13,6 @@ main (void)
_Decimal32 a = (d * d); _Decimal32 a = (d * d);
d32 b = (d * d); d32 b = (d * d);
if (a != b) if (a != b)
abort (); FAILURE
exit (0); FINISH
} }
/* Test for bug where fold narrowed decimal floating-point /* Test for bug where fold narrowed decimal floating-point
operations. */ operations. */
/* { dg-options "-std=gnu99" } */
extern void abort (void); #include "dfp-dbg.h"
extern void exit (int);
volatile _Decimal32 f = 1.23456DF; volatile _Decimal32 f = 1.23456DF;
volatile _Decimal64 d = 1.23456DD; volatile _Decimal64 d = 1.23456DD;
...@@ -12,6 +10,6 @@ int ...@@ -12,6 +10,6 @@ int
main (void) main (void)
{ {
if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d)) if ((double)((_Decimal64)f * (_Decimal64)f) != (double)(d * d))
abort (); FAILURE
exit (0); FINISH
} }
/* { dg-options "-std=gnu99" } */
/* This test assumes IEEE float and double. It also tests long double /* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */ but makes no assumption about its size or range of values. */
...@@ -31,7 +29,5 @@ main () ...@@ -31,7 +29,5 @@ main ()
CALL_VALID_ALL (t6) CALL_VALID_ALL (t6)
CALL_VALID_ALL (t7) CALL_VALID_ALL (t7)
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* This test assumes IEEE float and double. It also tests long double /* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */ but makes no assumption about its size or range of values. */
...@@ -19,7 +17,5 @@ main () ...@@ -19,7 +17,5 @@ main ()
{ {
CALL_ZEROES_ALL (t) CALL_ZEROES_ALL (t)
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* This test assumes IEEE float and double. It also tests long double /* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */ but makes no assumption about its size or range of values. */
...@@ -19,7 +17,5 @@ main () ...@@ -19,7 +17,5 @@ main ()
{ {
CALL_INF_ALL (t) CALL_INF_ALL (t)
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* This test assumes IEEE float and double. It also tests long double /* This test assumes IEEE float and double. It also tests long double
but makes no assumption about its size or range of values. */ but makes no assumption about its size or range of values. */
...@@ -19,7 +17,5 @@ main () ...@@ -19,7 +17,5 @@ main ()
{ {
CALL_NAN_ALL (t) CALL_NAN_ALL (t)
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */ /* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
/* { dg-options "-std=gnu99 -w" } */ /* { dg-options "-w" } */
/* This test assumes IEEE float and double. */ /* This test assumes IEEE float and double. */
...@@ -174,7 +174,5 @@ main () ...@@ -174,7 +174,5 @@ main ()
convert_364 (); convert_364 ();
} }
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -w" } */ /* { dg-options "-w" } */
/* This test assumes IEEE float and double. */ /* This test assumes IEEE float and double. */
...@@ -79,7 +79,5 @@ main () ...@@ -79,7 +79,5 @@ main ()
convert_351 (); convert_351 ();
convert_352 (); convert_352 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -w" } */ /* { dg-options "-w" } */
/* This test assumes IEEE float and double. */ /* This test assumes IEEE float and double. */
...@@ -67,7 +67,5 @@ main () ...@@ -67,7 +67,5 @@ main ()
convert_443 (); convert_443 ();
convert_444 (); convert_444 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */ /* { dg-xfail-run-if "" { lax_strtofp } "*" "" } */
/* { dg-options "-std=gnu99 -w" } */ /* { dg-options "-w" } */
/* This test assumes IEEE float and double. */ /* This test assumes IEEE float and double. */
...@@ -188,7 +188,5 @@ main () ...@@ -188,7 +188,5 @@ main ()
convert_419 (); convert_419 ();
convert_420 (); convert_420 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
/* N1150 5.2 Conversions among decimal floating types and between /* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types. decimal floating types and generic floating types.
......
/* { dg-options "-std=gnu99" } */
/* N1150 5.2 Conversions among decimal floating types and between /* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types. decimal floating types and generic floating types.
C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */ C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types. */
/* Long double isn't supported yet at runtime, so disable those checks. */ /* Long double isn't supported yet at runtime, so disable those checks. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
static int skip_long_double;
/* Support compiling the test to report individual failures; default is static int skip_long_double;
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
...@@ -138,8 +127,5 @@ main () ...@@ -138,8 +127,5 @@ main ()
|| df > (2.9802322387695312e-08 + 0.00000000001)) || df > (2.9802322387695312e-08 + 0.00000000001))
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
...@@ -3,17 +3,7 @@ ...@@ -3,17 +3,7 @@
/* N1150 5.3 Conversions between decimal floating and complex. /* N1150 5.3 Conversions between decimal floating and complex.
C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */ C99 6.3.1.7 Conversions, arithmetic operands, real and complex. */
extern void abort(void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
int int
main () main ()
...@@ -124,8 +114,5 @@ main () ...@@ -124,8 +114,5 @@ main ()
if (d128 != 0.0625DL) if (d128 != 0.0625DL)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* Test for bug where fold narrowed decimal floating-point /* Test for bug where fold narrowed decimal floating-point
operations. */ operations. */
/* { dg-options "-std=gnu99" } */
extern void abort (void); #include "dfp-dbg.h"
extern void exit (int);
volatile _Decimal32 f = 1.23456DF; volatile _Decimal32 f = 1.23456DF;
volatile _Decimal64 d = 1.23456DD; volatile _Decimal64 d = 1.23456DD;
...@@ -12,6 +10,6 @@ int ...@@ -12,6 +10,6 @@ int
main (void) main (void)
{ {
if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d)) if ((_Decimal128)((_Decimal64)f * (_Decimal64)f) != (_Decimal128)(d * d))
abort (); FAILURE
exit (0); FINISH
} }
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
/* N1150 5.2 Conversions among decimal floating types and between /* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types. decimal floating types and generic floating types.
......
/* { dg-options "-O0 -std=gnu99" } */ /* { dg-options "-O0" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */ /* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* N1150 5.2: Conversions among decimal floating types and between /* N1150 5.2: Conversions among decimal floating types and between
...@@ -12,20 +12,9 @@ ...@@ -12,20 +12,9 @@
Normally this would not be part of compiler testing, but conversions Normally this would not be part of compiler testing, but conversions
are currently handled in libgcc via decNumber. */ are currently handled in libgcc via decNumber. */
#include "dfp-dbg.h"
#include "dfp-round.h" #include "dfp-round.h"
extern void abort (void);
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
_Decimal128 d128; _Decimal128 d128;
...@@ -131,7 +120,5 @@ main () ...@@ -131,7 +120,5 @@ main ()
if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE if (!do_d128_to_d64 (-1.1111111111111125dl, -1.111111111111112dd)) FAILURE
if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE if (!do_d128_to_d64 (-1.1111111111111135dl, -1.111111111111113dd)) FAILURE
if (failcnt) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* N1150 5.2 Conversions among decimal floating types and between /* N1150 5.2 Conversions among decimal floating types and between
decimal floating types and generic floating types. decimal floating types and generic floating types.
...@@ -10,20 +10,9 @@ ...@@ -10,20 +10,9 @@
#define __STDC_WANT_DEC_FP__ 1 #define __STDC_WANT_DEC_FP__ 1
#endif #endif
#include "dfp-dbg.h"
#include <float.h> #include <float.h>
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
volatile _Decimal128 d128; volatile _Decimal128 d128;
...@@ -101,8 +90,5 @@ main () ...@@ -101,8 +90,5 @@ main ()
if (d64 != __builtin_infd64()) if (d64 != __builtin_infd64())
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
/* N1150 5.1 Conversion between decimal floating integer. /* N1150 5.1 Conversion between decimal floating integer.
C99 6.3.1.4(1a) New. C99 6.3.1.4(1a) New.
These should all be folded at compile time. */ These should all be folded at compile time. */
#include "dfp-dbg.h"
#define BOOL _Bool
extern void link_error (void); extern void link_error (void);
int int
...@@ -18,11 +22,11 @@ main () ...@@ -18,11 +22,11 @@ main ()
int si; int si;
long sl; long sl;
long long sll; long long sll;
_Bool b; BOOL b;
/* C99 Section 6.7.2 Type specifiers. Type _Bool is /* C99 Section 6.7.2 Type specifiers. Type _Bool is
mentioned in this section. Conversions between mentioned in this section. Conversions between
_Bool and DFP types. */ BOOL and DFP types. */
/* Decimal float to unsigned integer. */ /* Decimal float to unsigned integer. */
d32 = 456.789df; d32 = 456.789df;
...@@ -61,7 +65,7 @@ main () ...@@ -61,7 +65,7 @@ main ()
/* Decimal float to signed integer. */ /* Decimal float to signed integer. */
/* Decimal float to _Bool. */ /* Decimal float to BOOL. */
d32 = 1.23df; d32 = 1.23df;
d64 = -3.4dd; d64 = -3.4dd;
d128 = 0.00003dl; d128 = 0.00003dl;
...@@ -146,7 +150,7 @@ main () ...@@ -146,7 +150,7 @@ main ()
if (d128 != -1234567.dl) if (d128 != -1234567.dl)
link_error (); link_error ();
/* _Bool to decimal float. */ /* BOOL to decimal float. */
d32 = 0.0DF; d32 = 0.0DF;
d64 = 0.0DD; d64 = 0.0DD;
d128 = 0.0DL; d128 = 0.0DL;
......
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2 -w" } */
/* N1150 5.1 Conversions from decimal float to integer. */ /* N1150 5.1 Conversions from decimal float to integer. */
......
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0 -w" } */
/* N1150 5.1 Conversions from decimal float to integer. */ /* N1150 5.1 Conversions from decimal float to integer. */
...@@ -6,15 +6,7 @@ ...@@ -6,15 +6,7 @@
what will fit into the destination type. This assumes 32-bit int and what will fit into the destination type. This assumes 32-bit int and
64-bit long long (there's a check for that below). */ 64-bit long long (there's a check for that below). */
extern void abort (void); #include "dfp-dbg.h"
int failcnt;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
...@@ -150,7 +142,5 @@ main () ...@@ -150,7 +142,5 @@ main ()
doit (); doit ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* N1150 5.1 Conversion between decimal floating integer. /* N1150 5.1 Conversion between decimal floating integer.
C99 6.3.1.4(1a) New. C99 6.3.1.4(1a) New.
Test integer saturation. */ Test integer saturation. */
...@@ -8,11 +6,10 @@ ...@@ -8,11 +6,10 @@
#define __STDC_WANT_DEC_FP__ 1 #define __STDC_WANT_DEC_FP__ 1
#endif #endif
#include "dfp-dbg.h"
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
extern void abort (void);
volatile _Decimal32 d32; volatile _Decimal32 d32;
volatile _Decimal64 d64; volatile _Decimal64 d64;
volatile _Decimal128 d128; volatile _Decimal128 d128;
...@@ -28,40 +25,40 @@ main () ...@@ -28,40 +25,40 @@ main ()
/* Unsigned. */ /* Unsigned. */
usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ usi = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX) if (usi != UINT_MAX)
abort (); FAILURE
usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ usi = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX) if (usi != UINT_MAX)
abort (); FAILURE
usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (usi != UINT_MAX) if (usi != UINT_MAX)
abort (); FAILURE
/* Signed. */ /* Signed. */
si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX) if (si != INT_MAX)
abort (); FAILURE
si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX) if (si != INT_MAX)
abort (); FAILURE
si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MAX) if (si != INT_MAX)
abort (); FAILURE
si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN) if (si != INT_MIN)
abort (); FAILURE
si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN) if (si != INT_MIN)
abort (); FAILURE
si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */ si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
if (si != INT_MIN) if (si != INT_MIN)
abort (); FAILURE
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* N1150 5.1 Conversion between decimal floating types and integer. /* N1150 5.1 Conversion between decimal floating types and integer.
C99 6.3.1.4(1a) New. */ C99 6.3.1.4(1a) New. */
extern void abort (void); #include "dfp-dbg.h"
int failcnt;
#ifdef DBG #define BOOL _Bool
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
_Decimal32 d32; _Decimal32 d32;
_Decimal64 d64; _Decimal64 d64;
...@@ -22,7 +16,7 @@ unsigned long long ull; ...@@ -22,7 +16,7 @@ unsigned long long ull;
int si; int si;
long sl; long sl;
long long sll; long long sll;
_Bool b; BOOL b;
void void
init_dfp_1 (void) init_dfp_1 (void)
...@@ -68,7 +62,7 @@ main () ...@@ -68,7 +62,7 @@ main ()
{ {
/* C99 Section 6.7.2 Type specifiers. Type _Bool is /* C99 Section 6.7.2 Type specifiers. Type _Bool is
mentioned in this section. Conversions between mentioned in this section. Conversions between
_Bool and DFP types. */ BOOL and DFP types. */
/* Decimal float to unsigned integer. */ /* Decimal float to unsigned integer. */
init_dfp_1 (); init_dfp_1 ();
...@@ -105,7 +99,7 @@ main () ...@@ -105,7 +99,7 @@ main ()
/* Decimal float to signed integer. */ /* Decimal float to signed integer. */
/* Decimal float to _Bool. */ /* Decimal float to BOOL. */
init_dfp_2 (); init_dfp_2 ();
b = d32; b = d32;
...@@ -184,7 +178,7 @@ main () ...@@ -184,7 +178,7 @@ main ()
if (d128 != -1234567.dl) if (d128 != -1234567.dl)
FAILURE FAILURE
/* _Bool to decimal float. */ /* BOOL to decimal float. */
init_dfp_3 (); init_dfp_3 ();
b = d32; b = d32;
...@@ -197,8 +191,5 @@ main () ...@@ -197,8 +191,5 @@ main ()
if (b) if (b)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
extern void abort (void); #include "dfp-dbg.h"
static int failcnt = 0;
/* Macros are set up to skip using long double, which doesn't necessarily /* Macros are set up to skip using long double, which doesn't necessarily
map to TF mode. If there's a reason to skip those for a test, the map to TF mode. If there's a reason to skip those for a test, the
...@@ -8,14 +7,16 @@ static int failcnt = 0; ...@@ -8,14 +7,16 @@ static int failcnt = 0;
#define USE_TF 1 #define USE_TF 1
#endif #endif
/* Support compiling the test to report individual failures; default is /* Provide more information with FAILURE than what is available with
to abort as soon as a check fails. */ the version of that macro in dfp-dbg.h. */
#undef FAILURE
#if defined(DBG) || defined(DBG2) #if defined(DBG) || defined(DBG2)
#include <stdio.h> #include <stdio.h>
#define FAILURE(NUM) \ #define FAILURE(NUM) \
{ printf ("failed for test %s\n", NUM); failcnt++; } { printf ("failed for test %s\n", NUM); failures++; }
#else #else
#define FAILURE(N) abort (); #define FAILURE(N) __builtin_abort ();
#endif #endif
/* This is useful when modifying the test to make sure that tests are /* This is useful when modifying the test to make sure that tests are
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* N1150 3: Decimal floating types. /* N1150 3: Decimal floating types.
C99 6.7.2: Type specifiers */ C99 6.7.2: Type specifiers */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -O1" } */ /* { dg-options "-O1" } */
/* This used to result in an ICE. */ /* This used to result in an ICE. */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -D__STDC_WANT_DEC_FP__" } */ /* { dg-options "-D__STDC_WANT_DEC_FP__" } */
/* N1107 4: Characteristics of decimal floating types <float.h>. /* N1107 4: Characteristics of decimal floating types <float.h>.
C99 5.2.4.2.2a[2] (New). C99 5.2.4.2.2a[2] (New).
......
/* { dg-options "-std=gnu99" } */
/* N1150 4: Characteristics of decimal floating types <float.h>. /* N1150 4: Characteristics of decimal floating types <float.h>.
C99 5.2.4.2.2a[3]: New. C99 5.2.4.2.2a[3]: New.
...@@ -11,20 +9,9 @@ ...@@ -11,20 +9,9 @@
#define __STDC_WANT_DEC_FP__ 1 #define __STDC_WANT_DEC_FP__ 1
#endif #endif
#include "dfp-dbg.h"
#include <float.h> #include <float.h>
extern void abort (void);
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
int main () int main ()
{ {
if (DEC32_MANT_DIG != 7) FAILURE if (DEC32_MANT_DIG != 7) FAILURE
...@@ -56,8 +43,5 @@ int main () ...@@ -56,8 +43,5 @@ int main ()
if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL) if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
int failures;
#ifdef DBG
extern int printf (const char *, ...);
#define FAILURE { printf ("failed at line %d\n", __LINE__); failures++; }
#define FINISH if (failures != 0) __builtin_abort (); return 0;
#else
#define FAILURE __builtin_abort ();
#define FINISH return 0;
#endif
...@@ -37,12 +37,14 @@ if { ![check_effective_target_dfprt] } { ...@@ -37,12 +37,14 @@ if { ![check_effective_target_dfprt] } {
} }
verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2 verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then { if [info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS " -ansi -pedantic-errors" set save_default_cflags DEFAULT_CFLAGS
} }
# If a testcase doesn't have special options, use these.
set DEFAULT_CFLAGS "-std=gnu99"
# Initialize `dg'. # Initialize `dg'.
dg-init dg-init
...@@ -55,3 +57,6 @@ dg-finish ...@@ -55,3 +57,6 @@ dg-finish
set dg-do-what-default ${save-dg-do-what-default} set dg-do-what-default ${save-dg-do-what-default}
verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2 verbose "dfp.exp: dg-do-what-default is ${dg-do-what-default}" 2
if [info exists save_default_cflags] {
set DEFAULT_CFLAGS $save_default_cflags
}
/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */ /* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* Touch tests that check for raising appropriate exceptions for binary /* Touch tests that check for raising appropriate exceptions for binary
...@@ -102,7 +101,5 @@ main () ...@@ -102,7 +101,5 @@ main ()
binop_501 (); binop_501 ();
binop_502 (); binop_502 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
...@@ -2,19 +2,17 @@ ...@@ -2,19 +2,17 @@
are raised for decimal float operations. These tests are here to test are raised for decimal float operations. These tests are here to test
the software decimal float support in libgcc. */ the software decimal float support in libgcc. */
#include "dfp-dbg.h"
#include "dfp-except.h" #include "dfp-except.h"
extern void abort (void);
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#if defined(DBG) || defined(DBG2) #if defined(DBG) || defined(DBG2)
#include <stdio.h> #include <stdio.h>
#undef FAILURE
#define FAILURE(NUM,KIND,EXCEPT) \ #define FAILURE(NUM,KIND,EXCEPT) \
{ printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failcnt++; } { printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failures++; }
#else #else
#define FAILURE(N,K,E) abort (); #undef FAILURE
#define FAILURE(N,K,E) __builtin_abort ();
#endif #endif
/* This is useful when modifying the test to make sure that tests are /* This is useful when modifying the test to make sure that tests are
......
/* { dg-options "-std=gnu99" } */
/* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */ /* { dg-skip-if "test is for emulation" { hard_dfp } { "*" } { "" } } */
/* Check that appropriate exceptions are raised for conversions involving /* Check that appropriate exceptions are raised for conversions involving
...@@ -37,7 +36,5 @@ main () ...@@ -37,7 +36,5 @@ main ()
convert_121 (); convert_121 ();
convert_122 (); convert_122 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* Check that appropriate exceptions are raised for BFP to DFP conversions. /* Check that appropriate exceptions are raised for BFP to DFP conversions.
The test only uses double and _Decimal32; tests for conversions to The test only uses double and _Decimal32; tests for conversions to
_Decimal64 would need 128-bit long double. */ _Decimal64 would need 128-bit long double. */
...@@ -29,7 +27,5 @@ main () ...@@ -29,7 +27,5 @@ main ()
convert_104 (); convert_104 ();
convert_105 (); convert_105 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* Check that appropriate exceptions are raised for int to DFP conversions. */ /* Check that appropriate exceptions are raised for int to DFP conversions. */
#include "fe-check.h" #include "fe-check.h"
...@@ -43,7 +41,5 @@ main () ...@@ -43,7 +41,5 @@ main ()
convert_210 (); convert_210 ();
convert_211 (); convert_211 ();
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* Constant float values of type double in <float.h> are suffixed with L /* Constant float values of type double in <float.h> are suffixed with L
and cast to double so they can be used within code that uses pragma and cast to double so they can be used within code that uses pragma
......
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test passing array elements involving decimal floating point types. */ Test passing array elements involving decimal floating point types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return the Nth _Decimal32 argument of /* A handful of functions that return the Nth _Decimal32 argument of
an incoming array. */ an incoming array. */
...@@ -165,8 +153,5 @@ int main() ...@@ -165,8 +153,5 @@ int main()
if (arg4_128 (d128) != 4.0dl) FAILURE if (arg4_128 (d128) != 4.0dl) FAILURE
if (arg5_128 (d128) != 5.0dl) FAILURE if (arg5_128 (d128) != 5.0dl) FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating Test scalar passing and return values involving decimal floating
point types and dereferenced pointers. */ point types and dereferenced pointers. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32 /* A handful of functions that return their Nth _Decimal32
argument. */ argument. */
...@@ -213,8 +201,5 @@ main () ...@@ -213,8 +201,5 @@ main ()
if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl) if (arg5_128 (*pdl0, *pdl1, *pdl2, *pdl3, *pdl4, *pdl5) != 5.0dl)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99 -Wall" } */ /* { dg-options "-Wall" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating Test scalar passing and return values involving decimal floating
point types. */ point types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32 /* A handful of functions that return their Nth _Decimal32
argument with mixed types in parameter list. */ argument with mixed types in parameter list. */
...@@ -180,8 +170,5 @@ main () ...@@ -180,8 +170,5 @@ main ()
if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE if (arg4_128 (0, -1, 2.0f, 3.0, 4.0dl, 5.0l) != 4.0dl) FAILURE
if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE if (arg5_128 (0, -1, 2.0f, 3.0, 4.0l, 5.0dl) != 5.0dl) FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test pointer argument passing and return values involving decimal floating Test pointer argument passing and return values involving decimal floating
point types. */ point types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth pointer to Decimal32 /* A handful of functions that return their Nth pointer to Decimal32
argument. */ argument. */
...@@ -213,8 +201,5 @@ main () ...@@ -213,8 +201,5 @@ main ()
if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl) if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test scalar passing and return values involving decimal floating Test scalar passing and return values involving decimal floating
point types. */ point types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* A handful of functions that return their Nth _Decimal32 /* A handful of functions that return their Nth _Decimal32
argument. */ argument. */
...@@ -200,8 +188,5 @@ main () ...@@ -200,8 +188,5 @@ main ()
if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl) if (arg5_128 (0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test structure passing and return values involving decimal floating Test structure passing and return values involving decimal floating
point types. */ point types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
struct example struct example
{ {
...@@ -101,8 +89,5 @@ main () ...@@ -101,8 +89,5 @@ main ()
if (ptr_dummy1_field (&nums) != 'a') FAILURE if (ptr_dummy1_field (&nums) != 'a') FAILURE
if (ptr_dummy2_field (&nums) != 'b') FAILURE if (ptr_dummy2_field (&nums) != 'b') FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */ /* { dg-options "-mpreferred-stack-boundary=2" } */
/* Simple test of vararg passing for problematic types with and without /* Simple test of vararg passing for problematic types with and without
double values passed between them. */ double values passed between them. */
...@@ -17,5 +17,6 @@ int ...@@ -17,5 +17,6 @@ int
main () main ()
{ {
doit (); doit ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99" } */
/* Simple test of vararg passing for problematic types with and without /* Simple test of vararg passing for problematic types with and without
double values passed between them. */ double values passed between them. */
...@@ -16,5 +14,6 @@ int ...@@ -16,5 +14,6 @@ int
main () main ()
{ {
doit (); doit ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99" } */
/* Simple test of vararg passing for problematic types with and without /* Simple test of vararg passing for problematic types with and without
double values passed between them. */ double values passed between them. */
...@@ -16,5 +14,6 @@ int ...@@ -16,5 +14,6 @@ int
main () main ()
{ {
doit (); doit ();
return 0;
FINISH
} }
/* { dg-options "-std=gnu99" } */
/* Simple test of vararg passing for problematic types with and without /* Simple test of vararg passing for problematic types with and without
double values passed between them. */ double values passed between them. */
...@@ -16,5 +14,6 @@ int ...@@ -16,5 +14,6 @@ int
main () main ()
{ {
doit (); doit ();
return 0;
FINISH
} }
/* Simple test of vararg passing for problematic types with and without /* Simple test of vararg passing for problematic types with and without
double values passed between them. */ double values passed between them. */
#include "dfp-dbg.h"
#include <stdarg.h> #include <stdarg.h>
#ifdef DBG
#include <stdio.h>
#endif
extern void abort (void);
int failcnt;
DTYPE a[10]; DTYPE a[10];
double b[10]; double b[10];
...@@ -28,6 +23,7 @@ compare (double r, double s, int *p, int *q, int n, int line) ...@@ -28,6 +23,7 @@ compare (double r, double s, int *p, int *q, int n, int line)
{ {
int j; int j;
failures++;
printf ("line %-3d", line); printf ("line %-3d", line);
for (j = 0; j < n; j++) for (j = 0; j < n; j++)
printf (" %08x", p[j]); printf (" %08x", p[j]);
...@@ -39,7 +35,7 @@ compare (double r, double s, int *p, int *q, int n, int line) ...@@ -39,7 +35,7 @@ compare (double r, double s, int *p, int *q, int n, int line)
return; return;
} }
#else #else
abort (); __builtin_abort ();
#endif #endif
} }
...@@ -102,7 +98,7 @@ doit () ...@@ -102,7 +98,7 @@ doit ()
printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n", printf ("test error: INTS = %d, sizeof (DTYPE) = %d\n",
INTS, sizeof (DTYPE)); INTS, sizeof (DTYPE));
#endif #endif
abort (); __builtin_abort ();
} }
x = ONE / THREE; x = ONE / THREE;
...@@ -144,7 +140,4 @@ doit () ...@@ -144,7 +140,4 @@ doit ()
u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__); u1.d = x; u2.d = a[0]; compare (1.5, b[0], u1.i, u2.i, INTS, __LINE__);
u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__); u1.d = y; u2.d = a[1]; compare (2.5, b[1], u1.i, u2.i, INTS, __LINE__);
u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__); u1.d = z; u2.d = a[2]; compare (3.5, b[2], u1.i, u2.i, INTS, __LINE__);
if (failcnt != 0)
abort ();
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test passing varargs of the decimal float types. */ Test passing varargs of the decimal float types. */
#include <stdarg.h> #include <stdarg.h>
#include "dfp-dbg.h"
extern void abort (void);
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
static _Decimal32 static _Decimal32
vararg32 (unsigned arg, ...) vararg32 (unsigned arg, ...)
...@@ -104,7 +91,5 @@ int main() ...@@ -104,7 +91,5 @@ int main()
if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl) if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
FAILURE FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-std=gnu99 -mpreferred-stack-boundary=2" } */ /* { dg-options "-mpreferred-stack-boundary=2" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test passing varargs of the combination of decimal float types and Test passing varargs of the combination of decimal float types and
other types. */ other types. */
#include <stdarg.h> #include <stdarg.h>
#include "dfp-dbg.h"
extern void abort (void);
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* Supposing the list of varying number of arguments is: /* Supposing the list of varying number of arguments is:
unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
...@@ -112,7 +101,5 @@ main () ...@@ -112,7 +101,5 @@ main ()
if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. /* C99 6.5.2.2 Function calls.
Test passing varargs of the combination of decimal float types and Test passing varargs of the combination of decimal float types and
other types. */ other types. */
#include <stdarg.h> #include <stdarg.h>
#include "dfp-dbg.h"
extern void abort (void);
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
/* Supposing the list of varying number of arguments is: /* Supposing the list of varying number of arguments is:
unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */ unsigned int, _Decimal128, double, _Decimal32, _Decimal64. */
...@@ -111,7 +98,5 @@ main () ...@@ -111,7 +98,5 @@ main ()
if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE if (vararg_int (0, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 0) FAILURE
if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE if (vararg_double (2, 0, 1.0dl, 2.0, 3.0df, 4.0dd) != 2.0) FAILURE
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-options "-std=gnu99" } */
/* C99 6.5.2.2 Function calls. */ /* C99 6.5.2.2 Function calls. */
#include <stdarg.h> #include <stdarg.h>
#include "dfp-dbg.h"
extern void abort (void);
struct S1 struct S1
{ {
...@@ -38,7 +35,7 @@ main () ...@@ -38,7 +35,7 @@ main ()
struct S1 a1[5]; struct S1 a1[5];
if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0) if (check_var(5, 1.0, s1, 2LL, a1[2], a1[2]) == 0)
abort (); FAILURE
return 0; FINISH
} }
/* { dg-options "-std=gnu99" } */
/* N1150 4: Characteristics of decimal floating types (not explicit) /* N1150 4: Characteristics of decimal floating types (not explicit)
C99 5.2.4.2.2: Characteristics of floating types. C99 5.2.4.2.2: Characteristics of floating types.
A few simple checks on arithmetic operations. */ A few simple checks on arithmetic operations. */
extern void abort (void); #include "dfp-dbg.h"
int main() int main()
{ {
/* Assumes rounding mode. */ /* Assumes rounding mode. */
if (9999999.E90DF + 1.E90df != __builtin_infd32 ()) if (9999999.E90DF + 1.E90df != __builtin_infd32 ())
abort (); FAILURE
if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df)) if (!__builtin_isinfd32 (9999999.E90DF + 1.E90df))
abort (); FAILURE
if (9.999999999999999E384dd + .000000000000001e384dd if (9.999999999999999E384dd + .000000000000001e384dd
!= __builtin_infd32 ()) != __builtin_infd32 ())
abort (); FAILURE
if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ()) if (-9999999.E90DF - 1.E90df != -__builtin_infd32 ())
abort (); FAILURE
if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd)) if (!__builtin_isinfd32 (9.999999999999999E384dd + .000000000000001e384dd))
abort (); FAILURE
if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl if (7.999999999999999999999999999999999E6144dl + 3.0E6144dl
!= __builtin_infd32 ()) != __builtin_infd32 ())
abort (); FAILURE
if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ()) if (__builtin_infd32 () * __builtin_infd32 () != __builtin_infd32 ())
abort (); FAILURE
if (__builtin_infd32 () * 2 != __builtin_infd32 ()) if (__builtin_infd32 () * 2 != __builtin_infd32 ())
abort (); FAILURE
if (__builtin_infd64 () * -5 != -__builtin_infd32 ()) if (__builtin_infd64 () * -5 != -__builtin_infd32 ())
abort (); FAILURE
if (!__builtin_isinfd128 (__builtin_infd32 () / 4)) if (!__builtin_isinfd128 (__builtin_infd32 () / 4))
abort (); FAILURE
if (__builtin_infd64 () != __builtin_infd128 ()) if (__builtin_infd64 () != __builtin_infd128 ())
abort (); FAILURE
if (!__builtin_isinfd64 (__builtin_infd128 ())) if (!__builtin_isinfd64 (__builtin_infd128 ()))
abort (); FAILURE
if (__builtin_finited64 (__builtin_infd32 () * 4)) if (__builtin_finited64 (__builtin_infd32 () * 4))
abort (); FAILURE
if (!__builtin_finited128 (9.999999E90DL - 1.E90dd)) if (!__builtin_finited128 (9.999999E90DL - 1.E90dd))
abort (); FAILURE
if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ())) if (__builtin_finited128 (__builtin_infd32 () *__builtin_infd128 ()))
abort (); FAILURE
if (__builtin_finited32 (__builtin_nand32 (""))) if (__builtin_finited32 (__builtin_nand32 ("")))
abort (); FAILURE
return 0; FINISH
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -pedantic" } */ /* { dg-options "-pedantic" } */
/* Decimal float is a GCC extension. */ /* Decimal float is a GCC extension. */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* N1150 3: Decimal floating types. /* N1150 3: Decimal floating types.
C99 6.4.1(2): Keywords. C99 6.4.1(2): Keywords.
......
/* { dg-options "-std=gnu99" } */
/* C99 6.8.5.2: The for statement. */ /* C99 6.8.5.2: The for statement. */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "dfp-dbg.h"
void void
f32 (void) f32 (void)
...@@ -15,7 +14,7 @@ f32 (void) ...@@ -15,7 +14,7 @@ f32 (void)
i++; i++;
if (i != 5) if (i != 5)
abort(); FAILURE
} }
void void
...@@ -28,7 +27,7 @@ f64 (void) ...@@ -28,7 +27,7 @@ f64 (void)
i++; i++;
if (i != 5) if (i != 5)
abort(); FAILURE
} }
void void
...@@ -41,7 +40,7 @@ f128 (void) ...@@ -41,7 +40,7 @@ f128 (void)
i++; i++;
if (i != 5) if (i != 5)
abort(); FAILURE
} }
int int
...@@ -53,5 +52,6 @@ main () ...@@ -53,5 +52,6 @@ main ()
f64 (); f64 ();
f128 (); f128 ();
FINISH
return (0); return (0);
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
typedef float decimal32 __attribute__ ((mode (SD))); typedef float decimal32 __attribute__ ((mode (SD)));
typedef float decimal64 __attribute__ ((mode (DD))); typedef float decimal64 __attribute__ ((mode (DD)));
......
/* { dg-options "-std=gnu99" } */
/* N1150 4: Characteristics of decimal floating types (not explicit) /* N1150 4: Characteristics of decimal floating types (not explicit)
C99 5.2.4.2.2: Characteristics of floating types. C99 5.2.4.2.2: Characteristics of floating types.
A few simple checks on arithmetic operations. */ A few simple checks on arithmetic operations. */
extern void abort (void); #include "dfp-dbg.h"
int main() int main()
{ {
/* Some possibly non-obvious tests, but most logical /* Some possibly non-obvious tests, but most logical
operations on NaN return false, including NaN == NaN. */ operations on NaN return false, including NaN == NaN. */
if (__builtin_nand32("") == __builtin_nand32("")) if (__builtin_nand32("") == __builtin_nand32(""))
abort(); FAILURE
if (__builtin_nand64("") == __builtin_nand64("")) if (__builtin_nand64("") == __builtin_nand64(""))
abort(); FAILURE
if (__builtin_nand128("") == __builtin_nand128("")) if (__builtin_nand128("") == __builtin_nand128(""))
abort(); FAILURE
if (!(__builtin_nand32("") != __builtin_nand32(""))) if (!(__builtin_nand32("") != __builtin_nand32("")))
abort(); FAILURE
if (!(__builtin_nand64("") != __builtin_nand64(""))) if (!(__builtin_nand64("") != __builtin_nand64("")))
abort(); FAILURE
if (!(__builtin_nand128("") != __builtin_nand128(""))) if (!(__builtin_nand128("") != __builtin_nand128("")))
abort(); FAILURE
if (__builtin_nand32("") > __builtin_nand32("")) if (__builtin_nand32("") > __builtin_nand32(""))
abort(); FAILURE
if (__builtin_nand64("") >= __builtin_nand64("")) if (__builtin_nand64("") >= __builtin_nand64(""))
abort(); FAILURE
if (__builtin_nand128("") < __builtin_nand128("")) if (__builtin_nand128("") < __builtin_nand128(""))
abort(); FAILURE
if (-__builtin_nand128("") < +__builtin_nand128("")) if (-__builtin_nand128("") < +__builtin_nand128(""))
abort(); FAILURE
/* 0.0/0.0 => NaN, but NaN != NaN. */ /* 0.0/0.0 => NaN, but NaN != NaN. */
if (0.0df/0.0dl == __builtin_nand32("")) if (0.0df/0.0dl == __builtin_nand32(""))
abort(); FAILURE
/* 0.0 * INF => NaN. */ /* 0.0 * INF => NaN. */
if (!__builtin_isnand32 (0.0df * __builtin_infd32())) if (!__builtin_isnand32 (0.0df * __builtin_infd32()))
abort (); FAILURE
if (!__builtin_isnand64 (0.0dd * __builtin_infd64())) if (!__builtin_isnand64 (0.0dd * __builtin_infd64()))
abort (); FAILURE
if (!__builtin_isnand128 (0.0dd * __builtin_infd128())) if (!__builtin_isnand128 (0.0dd * __builtin_infd128()))
abort (); FAILURE
/* INF - INF => NaN. */ /* INF - INF => NaN. */
if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32())) if (!__builtin_isnand32 (__builtin_infd32() - __builtin_infd32()))
abort (); FAILURE
if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64())) if (!__builtin_isnand64 (__builtin_infd64() - __builtin_infd64()))
abort (); FAILURE
if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128())) if (!__builtin_isnand128 (__builtin_infd128() - __builtin_infd128()))
abort (); FAILURE
/* INF/INF => NaN. */ /* INF/INF => NaN. */
if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) ) if (!__builtin_isnand32 (__builtin_infd32()/__builtin_infd32()) )
abort (); FAILURE
if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) ) if (!__builtin_isnand64 (__builtin_infd64()/__builtin_infd64()) )
abort (); FAILURE
if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) ) if (!__builtin_isnand128 (__builtin_infd128()/__builtin_infd128()) )
abort (); FAILURE
/* 0.0/0.0 => NaN, but NaN != NaN. */ /* 0.0/0.0 => NaN, but NaN != NaN. */
if ((0.0dd/0.0df) == (0.0dd/0.0df)) if ((0.0dd/0.0df) == (0.0dd/0.0df))
abort(); FAILURE
if (__builtin_nand32("") < __builtin_infd32()) if (__builtin_nand32("") < __builtin_infd32())
abort(); FAILURE
if (__builtin_nand32("") >= __builtin_infd32()) if (__builtin_nand32("") >= __builtin_infd32())
abort(); FAILURE
/* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */ /* Fixme: Add sqrtdf(-x.df) test when sqrt is supported. */
if (!__builtin_isnand32(__builtin_nand32(""))) if (!__builtin_isnand32(__builtin_nand32("")))
abort(); FAILURE
if (!__builtin_isnand64(__builtin_nand64(""))) if (!__builtin_isnand64(__builtin_nand64("")))
abort(); FAILURE
if (!__builtin_isnand128(__builtin_nand128(""))) if (!__builtin_isnand128(__builtin_nand128("")))
abort(); FAILURE
if (!__builtin_isnand128(8.0df * __builtin_nand128(""))) if (!__builtin_isnand128(8.0df * __builtin_nand128("")))
abort(); FAILURE
if (!__builtin_isnand32(8.1dl - __builtin_nand32(""))) if (!__builtin_isnand32(8.1dl - __builtin_nand32("")))
abort(); FAILURE
if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128(""))) if (!__builtin_isnand128(__builtin_nand64("") + __builtin_nand128("")))
abort(); FAILURE
return 0; FINISH
} }
/* { dg-options "-std=gnu99" } */
/* N1150 4: Characteristics of decimal floating types (not explicit) /* N1150 4: Characteristics of decimal floating types (not explicit)
C99 5.2.4.2.2: Characteristics of floating types. C99 5.2.4.2.2: Characteristics of floating types.
A few simple checks on arithmetic operations. Based on nan-1.c with A few simple checks on arithmetic operations. Based on nan-1.c with
the consideration of negative zero. */ the consideration of negative zero. */
extern void abort (void); #include "dfp-dbg.h"
int main() int main()
{ {
...@@ -17,39 +15,39 @@ int main() ...@@ -17,39 +15,39 @@ int main()
result. */ result. */
d32 = 123.45f; d32 = 123.45f;
if (d32/-0.0df != -__builtin_infd32()) if (d32/-0.0df != -__builtin_infd32())
abort(); FAILURE
if (123.45df/-0.0df != -__builtin_infd32()) if (123.45df/-0.0df != -__builtin_infd32())
abort(); FAILURE
d64 = 123.45f; d64 = 123.45f;
if (d64/-0.0dd != -__builtin_infd64()) if (d64/-0.0dd != -__builtin_infd64())
abort(); FAILURE
if (123.45dd/-0.0dd != -__builtin_infd64()) if (123.45dd/-0.0dd != -__builtin_infd64())
abort(); FAILURE
d128 = 123.45f; d128 = 123.45f;
if (d128/-0.0dl != -__builtin_infd64()) if (d128/-0.0dl != -__builtin_infd64())
abort(); FAILURE
if (123.45dl/-0.0dl != -__builtin_infd128()) if (123.45dl/-0.0dl != -__builtin_infd128())
abort(); FAILURE
d32 = 0.0df; d32 = 0.0df;
if (!__builtin_isnand32(-(d32/-0.0df))) if (!__builtin_isnand32(-(d32/-0.0df)))
abort(); FAILURE
if (!__builtin_isnand32(-(0.0df/-0.0df))) if (!__builtin_isnand32(-(0.0df/-0.0df)))
abort(); FAILURE
d64 = 0.0dd; d64 = 0.0dd;
if (!__builtin_isnand64(-(d64/-0.0dd))) if (!__builtin_isnand64(-(d64/-0.0dd)))
abort(); FAILURE
if (!__builtin_isnand64(-(0.0dd/-0.0dd))) if (!__builtin_isnand64(-(0.0dd/-0.0dd)))
abort(); FAILURE
d128 = 0.0dl; d128 = 0.0dl;
if (!__builtin_isnand128(-(d128/-0.0dl))) if (!__builtin_isnand128(-(d128/-0.0dl)))
abort(); FAILURE
if (!__builtin_isnand128(-(0.0dl/-0.0dl))) if (!__builtin_isnand128(-(0.0dl/-0.0dl)))
abort(); FAILURE
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
/* C99 6.5.5: Multiplicative operators. /* C99 6.5.5: Multiplicative operators.
C99 6.5.6: Additive operators. */ C99 6.5.6: Additive operators. */
......
/* { dg-options "-std=gnu99" } */
/* C99 6.5.16 Assignment operators. /* C99 6.5.16 Assignment operators.
Verify the compound assignment operator for decimal float types, Verify the compound assignment operator for decimal float types,
using it with other decimal float types, integers, and other binary using it with other decimal float types, integers, and other binary
float types cast to decimal float types. */ float types cast to decimal float types. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
if (( OPRD1 OPRT OPRD2 )!= RLT) \ if (( OPRD1 OPRT OPRD2 )!= RLT) \
...@@ -64,8 +52,5 @@ main () ...@@ -64,8 +52,5 @@ main ()
DECIMAL_COMPOUND_ASSIGNMENT(64, d64); DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
DECIMAL_COMPOUND_ASSIGNMENT(128, d128); DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
if (failcnt != 0) FINISH
abort ();
return 0;
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* C99 6.5.10: Bitwise AND operator. /* C99 6.5.10: Bitwise AND operator.
C99 6.5.11: Bitwise exclusive OR operator. C99 6.5.11: Bitwise exclusive OR operator.
...@@ -7,8 +6,6 @@ ...@@ -7,8 +6,6 @@
Test that these operators do not accept decimal float operands. */ Test that these operators do not accept decimal float operands. */
extern void abort (void);
#define OPERATE(OPRD1,OPRT,OPRD2) \ #define OPERATE(OPRD1,OPRT,OPRD2) \
do \ do \
{ \ { \
......
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.17: Comma operator. /* C99 6.5.17: Comma operator.
Test with decimal float operands. */ Test with decimal float operands. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32a, d32b, d32c; volatile _Decimal32 d32a, d32b, d32c;
volatile _Decimal64 d64a, d64b, d64c; volatile _Decimal64 d64a, d64b, d64c;
...@@ -53,5 +43,5 @@ main () ...@@ -53,5 +43,5 @@ main ()
if (d64a != 12.0dd) if (d64a != 12.0dd)
FAILURE; FAILURE;
return 0; FINISH
} }
/* { dg-options "-std=gnu99 -O0" } */ /* { dg-options "-O0" } */
/* C99 6.5.15 Conditional operator. /* C99 6.5.15 Conditional operator.
Test with decimal float operands. */ Test with decimal float operands. */
extern void abort (void); #include "dfp-dbg.h"
static int failcnt = 0;
/* Support compiling the test to report individual failures; default is
to abort as soon as a check fails. */
#ifdef DBG
#include <stdio.h>
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
#else
#define FAILURE abort ();
#endif
volatile _Decimal32 d32a, d32b, d32c; volatile _Decimal32 d32a, d32b, d32c;
volatile _Decimal64 d64a, d64b, d64c; volatile _Decimal64 d64a, d64b, d64c;
...@@ -63,5 +53,5 @@ main () ...@@ -63,5 +53,5 @@ main ()
if (d128a != d128b) if (d128a != d128b)
FAILURE FAILURE
return 0; FINISH
} }
/* { dg-options "-std=gnu99" } */
/* C99 Logical AND operator. /* C99 Logical AND operator.
C99 Logical OR operator. C99 Logical OR operator.
Test with decimal float operands. */ Test with decimal float operands. */
extern void abort (void); #include "dfp-dbg.h"
#define OPERATE(OPRD1,OPRT,OPRD2,RLT) \ #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
do \ do \
{ \ { \
if (( (OPRD1) OPRT (OPRD2) )!= RLT) \ if (( (OPRD1) OPRT (OPRD2) )!= RLT) \
abort (); \ __builtin_abort (); \
} while (0) } while (0)
#define DECIMAL_LOGICAL_OR(OPRD) \ #define DECIMAL_LOGICAL_OR(OPRD) \
......
/* { dg-options "-std=gnu99" } */
/* C99 6.5.3 Unary operators. */ /* C99 6.5.3 Unary operators. */
extern void abort (void); #include "dfp-dbg.h"
#define AUTO_INCREASE_DECREASE(TYPE,SUFFIX) \ #define AUTO_INCREASE_DECREASE(TYPE,SUFFIX) \
do \ do \
{ \ { \
_Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX; \ _Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX; \
if (in_de_d##TYPE++) abort (); \ if (in_de_d##TYPE++) FAILURE \
if (--in_de_d##TYPE) abort (); \ if (--in_de_d##TYPE) FAILURE \
if (++in_de_d##TYPE == 0.0##SUFFIX) abort (); \ if (++in_de_d##TYPE == 0.0##SUFFIX) FAILURE \
if (in_de_d##TYPE-- == 0.0##SUFFIX) abort (); \ if (in_de_d##TYPE-- == 0.0##SUFFIX) FAILURE \
} while(0) } while(0)
#define UNARY_OPERATOR(TYPE,SUFFIX) \ #define UNARY_OPERATOR(TYPE,SUFFIX) \
do \ do \
{ \ { \
_Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX; \ _Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX; \
_Decimal##TYPE* unary_dp##TYPE; \ _Decimal##TYPE* unary_dp##TYPE; \
/* & operator. */ \ /* & operator. */ \
unary_dp##TYPE = &(unary_d##TYPE); \ unary_dp##TYPE = &(unary_d##TYPE); \
...@@ -25,11 +23,11 @@ do \ ...@@ -25,11 +23,11 @@ do \
unary_d##TYPE = *(unary_dp##TYPE); \ unary_d##TYPE = *(unary_dp##TYPE); \
/* - operator. */ \ /* - operator. */ \
unary_d##TYPE = -unary_d##TYPE; \ unary_d##TYPE = -unary_d##TYPE; \
if (unary_d##TYPE != -1.0##SUFFIX) abort (); \ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
/* + operator. */ \ /* + operator. */ \
unary_d##TYPE = +unary_d##TYPE; \ unary_d##TYPE = +unary_d##TYPE; \
if (unary_d##TYPE != -1.0##SUFFIX) abort (); \ if (unary_d##TYPE != -1.0##SUFFIX) FAILURE \
if (!unary_d##TYPE) abort (); /*! operator. */ \ if (!unary_d##TYPE) FAILURE /*! operator. */ \
} while (0) } while (0)
int int
...@@ -46,9 +44,9 @@ main () ...@@ -46,9 +44,9 @@ main ()
UNARY_OPERATOR(128, DL); UNARY_OPERATOR(128, DL);
/* C99 6.5.3 Unary operators for zero values. */ /* C99 6.5.3 Unary operators for zero values. */
if (- +0.df != -0.df) abort (); if (- +0.df != -0.df) FAILURE
if (+ -0.df != -0.df) abort (); if (+ -0.df != -0.df) FAILURE
if (- -0.df != +0.df) abort (); if (- -0.df != +0.df) FAILURE
return 0; FINISH
} }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -std=gnu99 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ /* { dg-options "-O -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-O -std=gnu99" } */ /* { dg-options "-O" } */
typedef struct typedef struct
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
typedef _Decimal32 fp_t; typedef _Decimal32 fp_t;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
/* The suffix for a decimal float constant must use a single case. /* The suffix for a decimal float constant must use a single case.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-std=gnu99 -O2" } */ /* { dg-options "-O2" } */
extern void foo (_Decimal32); extern void foo (_Decimal32);
_Decimal32 *p; _Decimal32 *p;
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-std=gnu99" } */
#include <stdarg.h> #include <stdarg.h>
extern void abort (void); #include "dfp-dbg.h"
void void
f (int a, ...) f (int a, ...)
{ {
va_list ap; va_list ap;
if (a != 0) if (a != 0)
abort (); FAILURE
va_start (ap, a); va_start (ap, a);
if (va_arg (ap, _Decimal128) != 1.2DL) if (va_arg (ap, _Decimal128) != 1.2DL)
abort (); FAILURE
if (va_arg (ap, _Decimal128) != 2.34DL) if (va_arg (ap, _Decimal128) != 2.34DL)
abort (); FAILURE
if (va_arg (ap, _Decimal128) != 3.456DL) if (va_arg (ap, _Decimal128) != 3.456DL)
abort (); FAILURE
if (va_arg (ap, _Decimal128) != 4.567DL) if (va_arg (ap, _Decimal128) != 4.567DL)
abort (); FAILURE
if (va_arg (ap, double) != 5.125) if (va_arg (ap, double) != 5.125)
abort (); FAILURE
va_end (ap); va_end (ap);
} }
...@@ -28,5 +27,6 @@ int ...@@ -28,5 +27,6 @@ int
main (void) main (void)
{ {
f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125); f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125);
return 0;
FINISH
} }
/* { dg-do compile { target fpic } } */ /* { dg-do compile { target fpic } } */
/* { dg-options "-std=gnu99 -O2 -fPIC" } */ /* { dg-options "-O2 -fPIC" } */
volatile _Decimal32 d; volatile _Decimal32 d;
volatile int i; volatile int i;
......
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