diff options
author | bje <bje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-11 21:29:59 +0000 |
---|---|---|
committer | bje <bje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-11 21:29:59 +0000 |
commit | 41a20961fce18fb62efd1af115096db194ea442c (patch) | |
tree | 9aff0dc626b4d53c1ff32ce6d509433c47ba166d /gcc/testsuite/gcc.dg/dfp/compare-eq.h | |
parent | bebf8106efd68a7fb12219087852ec819deec904 (diff) | |
download | gcc-41a20961fce18fb62efd1af115096db194ea442c.tar.gz |
* gcc.dg/nodfp-1.c: New test.
* gcc.dg/compat/scalar-return-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_main.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_main.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_x.c: Likewise.
* gcc.dg/compat/scalar-return-dfp_y.c: Likewise.
* gcc.dg/compat/scalar-by-value-dfp_y.c: Likewise.
* gcc.dg/debug/dwarf2/dwarf-float.c: Likewise.
* gcc.dg/debug/dwarf2/dwarf-dfp.c: Likewise.
* gcc.dg/format/dfp-scanf-1.c: Likewise.
* gcc.dg/format/dfp-printf-1.c: Likewise.
* gcc.dg/compat/struct-layout-1.exp: Use c-compat.exp.
(compat_setup_dfp): New.
* gcc.dg/compat/compat.exp: Use it.
(compat-use-alt-compiler, compat-use-tst-compiler): Move to new file.
Make some variables global, prepend "compat_" to their names.
* gcc.dg/compat/struct-layout-1.h: Conditional DFP support.
* gcc.dg/compat/struct-layout-1_generate.c: Ditto.
* gcc.misc-tests/dectest.exp: New test driver for decTest.
* lib/compat.exp (compat_skip_list): Make global, rename.
* lib/c-compat.exp: New file.
* lib/target-supports.exp (check_effective_target_dfp): New.
* gcc.dg/dfp/dec-eval-method.c, gcc.dg/dfp/func-array.c,
gcc.dg/dfp/convert-dfp-fold.c, gcc.dg/dfp/struct-union.c,
gcc.dg/dfp/compare-rel.h, gcc.dg/dfp/convert-dfp-round.c,
gcc.dg/dfp/func-struct.c, gcc.dg/dfp/constants-c99.c,
gcc.dg/dfp/compare-eq-d32.c, gcc.dg/dfp/func-vararg-mixed.c,
gcc.dg/dfp/compare-rel-d128.c, gcc.dg/dfp/operator-comma.c,
gcc.dg/dfp/decfloat-constants.c, gcc.dg/dfp/operator-bitwise.c,
gcc.dg/dfp/func-mixed.c, gcc.dg/dfp/compare-eq-dfp.c,
gcc.dg/dfp/operator-assignment.c, gcc.dg/dfp/dfp-round.h,
gcc.dg/dfp/modes.c, gcc.dg/dfp/keywords-c99.c, gcc.dg/dfp/nan-1.c,
gcc.dg/dfp/loop-index.c, gcc.dg/dfp/compare-eq-d64.c,
gcc.dg/dfp/convert-bfp.c, gcc.dg/dfp/usual-arith-conv-const.c,
gcc.dg/dfp/convert-dfp.c, gcc.dg/dfp/compare-rel-const.c,
gcc.dg/dfp/convert-int-fold.c, gcc.dg/dfp/keywords-pedantic.c,
gcc.dg/dfp/compare-rel-d32.c, gcc.dg/dfp/call-by-value.c,
gcc.dg/dfp/constants-hex.c, gcc.dg/dfp/func-scalar.c,
gcc.dg/dfp/keywords-ignored-c99.c, gcc.dg/dfp/snan.c,
gcc.dg/dfp/usual-arith-conv.c, gcc.dg/dfp/constants-pedantic.c,
gcc.dg/dfp/operator-logical.c, gcc.dg/dfp/compare-eq-d128.c,
gcc.dg/dfp/convert-bfp-fold.c, gcc.dg/dfp/ctypes.c,
gcc.dg/dfp/convert-int.c, gcc.dg/dfp/keywords-c89.c,
gcc.dg/dfp/constants.c, gcc.dg/dfp/compare-rel-dfp.c,
gcc.dg/dfp/compare-eq-const.c, gcc.dg/dfp/cast-bad.c,
gcc.dg/dfp/operator-arith-fold.c, gcc.dg/dfp/union-init.c,
gcc.dg/dfp/struct-layout-1.c,
gcc.dg/dfp/compare-eq.hgcc.dg/dfp/convert-int-saturate.c,
gcc.dg/dfp/compare-rel-d64.c, gcc.dg/dfp/func-vararg-size0.c,
gcc.dg/dfp/Wconversion-2.c, gcc.dg/dfp/nan-2.c,
gcc.dg/dfp/operator-cond.c, gcc.dg/dfp/composite-type.c,
gcc.dg/dfp/func-vararg-dfp.c,
gcc.dg/dfp/dfp.expgcc.dg/dfp/keywords-reserved.c,
gcc.dg/dfp/convert-complex.c, gcc.dg/dfp/Wbad-function-cast-1.c,
gcc.dg/dfp/operator-unary.c, gcc.dg/dfp/altivec-types.c,
gcc.dg/dfp/cast.c, gcc.dg/dfp/typespec.c,
gcc.dg/dfp/wtr-conversion-1.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/dfp/compare-eq.h')
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/compare-eq.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/dfp/compare-eq.h b/gcc/testsuite/gcc.dg/dfp/compare-eq.h new file mode 100644 index 00000000000..809d642593c --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/compare-eq.h @@ -0,0 +1,96 @@ +/* Basic test of runtime equality comparisons using simple values that + are not affected by rounding. */ + +#include <stdlib.h> + +static int failcnt; + +#define PASTE2(A,B) A ## B +#define PASTE(A,B) PASTE2(A,B) + +#ifdef DBG +#include <stdio.h> +#define FAILURE(OP,KIND) \ + { printf ("failed at line %d: %s for %s values\n", __LINE__, OP, KIND); \ + failcnt++; } +#else +#define FAILURE(OP,KIND) abort (); +#endif + +#ifndef WIDTH +#error define WIDTH as decimal float size in bytes +#endif + +#if WIDTH == 32 +#define DTYPE _Decimal32 +#define SUFFIX DF +#elif WIDTH == 64 +#define DTYPE _Decimal64 +#define SUFFIX DD +#elif WIDTH == 128 +#define DTYPE _Decimal128 +#define SUFFIX DL +#elif WIDTH == 0 +/* This is for testing the test using a type known to work. */ +#define DTYPE double +#define SUFFIX +#else +#error invalid width for decimal float type +#endif + +DTYPE m_two = PASTE(-2.0, SUFFIX); +DTYPE m_one = PASTE(-1.0, SUFFIX); +DTYPE zero = PASTE(0.0, SUFFIX); +DTYPE one = PASTE(1.0, SUFFIX); +DTYPE two = PASTE(2.0, SUFFIX); + +void +test_compares (void) +{ + DTYPE x = one; + DTYPE y = zero; + DTYPE z = m_one; + + /* Equal to: comparisons against equal values. */ + + if (! (x == one)) FAILURE ("==", "equal") + if (! (y == zero)) FAILURE ("==", "equal") + if (! (z == m_one)) FAILURE ("==", "equal") + + /* Equal to: comparisons against lesser values. */ + + if (x == m_one) FAILURE ("==", "lesser") + if (x == zero) FAILURE ("==", "lesser") + if (y == m_one) FAILURE ("==", "lesser") + if (z == m_two) FAILURE ("==", "lesser") + + /* Equal to: comparisons against greater values. */ + + if (x == two) FAILURE ("==", "greater") + if (y == one) FAILURE ("==", "greater") + if (z == zero) FAILURE ("==", "greater") + if (z == one) FAILURE ("==", "greater") + + /* Not equal to: comparisons against equal values. */ + + if (x != one) FAILURE ("!=", "equal") + if (y != zero) FAILURE ("!=", "equal") + if (z != m_one) FAILURE ("!=", "equal") + + /* Not equal to: comparisons against lesser values. */ + + if (! (x != m_one)) FAILURE ("!=", "lesser") + if (! (x != zero)) FAILURE ("!=", "lesser") + if (! (y != m_one)) FAILURE ("!=", "lesser") + if (! (z != m_two)) FAILURE ("!=", "lesser") + + /* Not equal to: comparisons against greater values. */ + + if (! (x != m_one)) FAILURE ("!=", "greater") + if (! (x != zero)) FAILURE ("!=", "greater") + if (! (y != m_one)) FAILURE ("!=", "greater") + if (! (z != m_two)) FAILURE ("!=", "greater") + + if (failcnt) + abort (); +} |