From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.dg/dfp/fe-check.h | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/dfp/fe-check.h (limited to 'gcc/testsuite/gcc.dg/dfp/fe-check.h') diff --git a/gcc/testsuite/gcc.dg/dfp/fe-check.h b/gcc/testsuite/gcc.dg/dfp/fe-check.h new file mode 100644 index 000000000..9c5f0ff8c --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/fe-check.h @@ -0,0 +1,68 @@ +/* Common support for checking that appropriate floating point exceptions + are raised for decimal float operations. These tests are here to test + the software decimal float support in libgcc. */ + +#include "dfp-dbg.h" +#include "dfp-except.h" + +#if defined(DBG) || defined(DBG2) +#include +#undef FAILURE +#define FAILURE(NUM,KIND,EXCEPT) \ + { printf ("failed for test %d: %s %s\n", NUM, KIND, EXCEPT); failures++; } +#else +#undef FAILURE +#define FAILURE(N,K,E) __builtin_abort (); +#endif + +/* This is useful when modifying the test to make sure that tests are + actually run. */ +#if defined(DBG2) +#define SUCCESS(NUM,EXCEPT) \ + { printf ("passed for test %d: %s\n", NUM, EXCEPT); } +#else +#define SUCCESS(N,E) ; +#endif + +#define CHECKFLAG(NUM,EXCEPT,GOT,WANT) \ + if ((WANT & EXCEPT) != (GOT & EXCEPT)) \ + { \ + if ((WANT & EXCEPT) != 0) \ + FAILURE (NUM, "missing", #EXCEPT) \ + else \ + FAILURE (NUM, "unexpected", #EXCEPT) \ + } \ + else \ + SUCCESS (NUM, #EXCEPT) + +void +checkflags (int num, int want) +{ + int got = DFP_TEST_EXCEPT (FE_ALL_EXCEPT); + CHECKFLAG (num, FE_INVALID, got, want) + CHECKFLAG (num, FE_OVERFLOW, got, want) + CHECKFLAG (num, FE_UNDERFLOW, got, want) + CHECKFLAG (num, FE_DIVBYZERO, got, want) + CHECKFLAG (num, FE_INEXACT, got, want) +} + +#define BINOP(NUM,OP,VAR1,VAL1,VAR2,VAL2,VAR3,EXCEPT) \ +void \ +binop_##NUM (void) \ +{ \ + VAR1 = VAL1; \ + VAR2 = VAL2; \ + DFP_CLEAR_EXCEPT (FE_ALL_EXCEPT); \ + VAR3 = VAR1 OP VAR2; \ + checkflags (NUM, EXCEPT); \ +} + +#define CONVERT(NUM,FROM,TO,VALUE,EXCEPT) \ +void \ +convert_##NUM (void) \ +{ \ + FROM = VALUE; \ + DFP_CLEAR_EXCEPT (FE_ALL_EXCEPT); \ + TO = FROM; \ + checkflags (NUM, EXCEPT); \ +} -- cgit v1.2.3