diff options
26 files changed, 451 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 34451e1..32e4c30 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2013-11-04 Joseph Myers <joseph@codesourcery.com> + + * doc/cpp.texi (__GCC_IEC_559, __GCC_IEC_559_COMPLEX): Document + macros. + * target.def (float_exceptions_rounding_supported_p): New hook. + * targhooks.c (default_float_exceptions_rounding_supported_p): New + function. + * targhooks.h (default_float_exceptions_rounding_supported_p): + Declare. + * doc/tm.texi.in (TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P): + New @hook. + * doc/tm.texi: Regenerate. + * config.gcc (powerpc*-*-linux*): Set extra_objs. + * config/rs6000/rs6000-linux.c: New file. + * config/rs6000/rs6000-protos.h + (rs6000_linux_float_exceptions_rounding_supported_p): Declare. + * config/rs6000/linux.h + (TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P): New macro. + * config/rs6000/linux64.h + (TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P): Likewise. + * config/rs6000/t-linux (rs6000-linux.o): New rule. + * config/rs6000/t-linux64 (rs6000-linux.o): Likewise. + 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vsx.md (*vsx_le_perm_store_<mode> for VSX_D): diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2a6223b..6747bdd 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2013-11-04 Joseph Myers <joseph@codesourcery.com> + + * c-cppbuiltin.c (cpp_iec_559_value, cpp_iec_559_complex_value): + New functions. + (c_cpp_builtins): Define __GCC_IEC_559 and __GCC_IEC_559_COMPLEX. + 2013-11-04 Eric Botcazou <ebotcazou@adacore.com> * c-ada-spec.h (cpp_operation): Add IS_TRIVIAL. diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index ed4c82c..09c75c4 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -683,6 +683,92 @@ cpp_atomic_builtins (cpp_reader *pfile) (have_swap[psize]? 2 : 1)); } +/* Return the value for __GCC_IEC_559. */ +static int +cpp_iec_559_value (void) +{ + /* The default is support for IEEE 754-2008. */ + int ret = 2; + + /* float and double must be binary32 and binary64. If they are but + with reversed NaN convention, at most IEEE 754-1985 is + supported. */ + const struct real_format *ffmt + = REAL_MODE_FORMAT (TYPE_MODE (float_type_node)); + const struct real_format *dfmt + = REAL_MODE_FORMAT (TYPE_MODE (double_type_node)); + if (!ffmt->qnan_msb_set || !dfmt->qnan_msb_set) + ret = 1; + if (ffmt->b != 2 + || ffmt->p != 24 + || ffmt->pnan != 24 + || ffmt->emin != -125 + || ffmt->emax != 128 + || ffmt->signbit_rw != 31 + || ffmt->round_towards_zero + || !ffmt->has_sign_dependent_rounding + || !ffmt->has_nans + || !ffmt->has_inf + || !ffmt->has_denorm + || !ffmt->has_signed_zero + || dfmt->b != 2 + || dfmt->p != 53 + || dfmt->pnan != 53 + || dfmt->emin != -1021 + || dfmt->emax != 1024 + || dfmt->signbit_rw != 63 + || dfmt->round_towards_zero + || !dfmt->has_sign_dependent_rounding + || !dfmt->has_nans + || !dfmt->has_inf + || !dfmt->has_denorm + || !dfmt->has_signed_zero) + ret = 0; + + /* In strict C standards conformance mode, consider unpredictable + excess precision to mean lack of IEEE 754 support. ??? The same + should apply to unpredictable contraction, but at present + standards conformance options do not enable conforming + contraction. For C++, and outside strict conformance mode, do + not consider these options to mean lack of IEEE 754 support. */ + if (flag_iso + && !c_dialect_cxx () + && TARGET_FLT_EVAL_METHOD != 0 + && flag_excess_precision != EXCESS_PRECISION_STANDARD) + ret = 0; + + /* Various options are contrary to IEEE 754 semantics. */ + if (flag_unsafe_math_optimizations + || flag_associative_math + || flag_reciprocal_math + || flag_finite_math_only + || !flag_signed_zeros + || flag_single_precision_constant) + ret = 0; + + /* If the target does not support IEEE 754 exceptions and rounding + modes, consider IEEE 754 support to be absent. */ + if (!targetm.float_exceptions_rounding_supported_p ()) + ret = 0; + + return ret; +} + +/* Return the value for __GCC_IEC_559_COMPLEX. */ +static int +cpp_iec_559_complex_value (void) +{ + /* The value is no bigger than that of __GCC_IEC_559. */ + int ret = cpp_iec_559_value (); + + /* Some options are contrary to the required default state of the + CX_LIMITED_RANGE pragma. */ + if (flag_complex_method != 2) + ret = 0; + + return ret; +} + /* Hook that registers front end and target-specific built-ins. */ void c_cpp_builtins (cpp_reader *pfile) @@ -760,6 +846,13 @@ c_cpp_builtins (cpp_reader *pfile) /* stdint.h and the testsuite need to know these. */ builtin_define_stdint_macros (); + /* Provide information for library headers to determine whether to + define macros such as __STDC_IEC_559__ and + __STDC_IEC_559_COMPLEX__. */ + builtin_define_with_int_value ("__GCC_IEC_559", cpp_iec_559_value ()); + builtin_define_with_int_value ("__GCC_IEC_559_COMPLEX", + cpp_iec_559_complex_value ()); + /* float.h needs to know this. */ builtin_define_with_int_value ("__FLT_EVAL_METHOD__", TARGET_FLT_EVAL_METHOD); diff --git a/gcc/config.gcc b/gcc/config.gcc index e1878bd..6c62a64 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2214,6 +2214,7 @@ powerpc*-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + extra_objs="$extra_objs rs6000-linux.o" case ${target} in powerpc*le-*-*) tm_file="${tm_file} rs6000/sysv4le.h" ;; diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index 2e5a56b..f7df111 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -145,3 +145,9 @@ /* Static stack checking is supported by means of probes. */ #define STACK_CHECK_STATIC_BUILTIN 1 + +/* Software floating point support for exceptions and rounding modes + depends on the C library in use. */ +#undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P +#define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \ + rs6000_linux_float_exceptions_rounding_supported_p diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 439f53f..c1adbd7 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -558,3 +558,9 @@ extern int dot_symbols; /* The default value isn't sufficient in 64-bit mode. */ #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) + +/* Software floating point support for exceptions and rounding modes + depends on the C library in use. */ +#undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P +#define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \ + rs6000_linux_float_exceptions_rounding_supported_p diff --git a/gcc/config/rs6000/rs6000-linux.c b/gcc/config/rs6000/rs6000-linux.c new file mode 100644 index 0000000..17b51af --- /dev/null +++ b/gcc/config/rs6000/rs6000-linux.c @@ -0,0 +1,38 @@ +/* Functions for Linux on PowerPC. + Copyright (C) 2013 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "rtl.h" +#include "tm_p.h" + +/* Implement TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P. */ + +bool +rs6000_linux_float_exceptions_rounding_supported_p (void) +{ + /* glibc has support for exceptions and rounding modes for software + floating point. */ + if (OPTION_GLIBC) + return true; + else + return TARGET_DF_INSN; +} diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index c35e44d..d1d1737 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -212,4 +212,6 @@ void rs6000_final_prescan_insn (rtx, rtx *operand, int num_operands); extern bool rs6000_hard_regno_mode_ok_p[][FIRST_PSEUDO_REGISTER]; extern unsigned char rs6000_class_max_nregs[][LIM_REG_CLASSES]; extern unsigned char rs6000_hard_regno_nregs[][FIRST_PSEUDO_REGISTER]; + +extern bool rs6000_linux_float_exceptions_rounding_supported_p (void); #endif /* rs6000-protos.h */ diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux index 62a5b94..0b92eba 100644 --- a/gcc/config/rs6000/t-linux +++ b/gcc/config/rs6000/t-linux @@ -7,3 +7,7 @@ else MULTIARCH_DIRNAME = powerpc-linux-gnu endif endif + +rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 index 70e928d..0b17ed6 100644 --- a/gcc/config/rs6000/t-linux64 +++ b/gcc/config/rs6000/t-linux64 @@ -30,3 +30,7 @@ MULTILIB_DIRNAMES := 64 32 MULTILIB_EXTRA_OPTS := MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) + +rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c + $(COMPILE) $< + $(POSTCOMPILE) diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 7ff04cd..0ab9361 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -2389,6 +2389,40 @@ These macros are defined with value 1 if the backend supports the the include file @file{math.h} can define the macros @code{FP_FAST_FMA}, @code{FP_FAST_FMAF}, and @code{FP_FAST_FMAL} for compatibility with the 1999 C standard. + +@item __GCC_IEC_559 +This macro is defined to indicate the intended level of support for +IEEE 754 (IEC 60559) floating-point arithmetic. It expands to a +nonnegative integer value. If 0, it indicates that the combination of +the compiler configuration and the command-line options is not +intended to support IEEE 754 arithmetic for @code{float} and +@code{double} as defined in C99 and C11 Annex F (for example, that the +standard rounding modes and exceptions are not supported, or that +optimizations are enabled that conflict with IEEE 754 semantics). If +1, it indicates that IEEE 754 arithmetic is intended to be supported; +this does not mean that all relevant language features are supported +by GCC. If 2 or more, it additionally indicates support for IEEE +754-2008 (in particular, that the binary encodings for quiet and +signaling NaNs are as specified in IEEE 754-2008). + +This macro does not indicate the default state of command-line options +that control optimizations that C99 and C11 permit to be controlled by +standard pragmas, where those standards do not require a particular +default state. It does not indicate whether optimizations respect +signaling NaN semantics (the macro for that is +@code{__SUPPORT_SNAN__}). It does not indicate support for decimal +floating point or the IEEE 754 binary16 and binary128 types. + +@item __GCC_IEC_559_COMPLEX +This macro is defined to indicate the intended level of support for +IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers, as +defined in C99 and C11 Annex G. It expands to a nonnegative integer +value. If 0, it indicates that the combination of the compiler +configuration and the command-line options is not intended to support +Annex G requirements (for example, because @option{-fcx-limited-range} +was used). If 1 or more, it indicates that it is intended to support +those requirements; this does not mean that all relevant language +features are supported by GCC. @end table @node System-specific Predefined Macros diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 72daf09..fc5e1a5 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -768,6 +768,10 @@ Define this macro to 1 if your target needs this facility. The default is 0. @end defmac +@deftypefn {Target Hook} bool TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P (void) +Returns true if the target supports IEEE 754 floating-point exceptions and rounding modes, false otherwise. This is intended to relate to the @code{float} and @code{double} types, but not necessarily @code{long double}. By default, returns true if the @code{adddf3} instruction pattern is available and false otherwise, on the assumption that hardware floating point supports exceptions and rounding modes but software floating point does not. +@end deftypefn + @node Per-Function Data @section Defining data structures for per-function information. @cindex per-function data diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 2828361..a641f3d 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -744,6 +744,8 @@ Define this macro to 1 if your target needs this facility. The default is 0. @end defmac +@hook TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P + @node Per-Function Data @section Defining data structures for per-function information. @cindex per-function data diff --git a/gcc/target.def b/gcc/target.def index cf3e2fd..3bbbbd3 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1935,6 +1935,18 @@ DEFHOOK_UNDOC bool, (void), targhook_float_words_big_endian) +DEFHOOK +(float_exceptions_rounding_supported_p, + "Returns true if the target supports IEEE 754 floating-point exceptions\ + and rounding modes, false otherwise. This is intended to relate to the\ + @code{float} and @code{double} types, but not necessarily @code{long double}.\ + By default, returns true if the @code{adddf3} instruction pattern is\ + available and false otherwise, on the assumption that hardware floating\ + point supports exceptions and rounding modes but software floating point\ + does not.", + bool, (void), + default_float_exceptions_rounding_supported_p) + /* True if the target supports decimal floating point. */ DEFHOOK (decimal_float_supported_p, diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 6674109..7585c14 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -436,6 +436,19 @@ targhook_float_words_big_endian (void) return !!FLOAT_WORDS_BIG_ENDIAN; } +/* True if the target supports floating-point exceptions and rounding + modes. */ + +bool +default_float_exceptions_rounding_supported_p (void) +{ +#ifdef HAVE_adddf3 + return HAVE_adddf3; +#else + return false; +#endif +} + /* True if the target supports decimal floating point. */ bool diff --git a/gcc/targhooks.h b/gcc/targhooks.h index c810998..e3e613a 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -69,6 +69,7 @@ extern tree default_mangle_assembler_name (const char *); extern bool default_scalar_mode_supported_p (enum machine_mode); extern bool targhook_words_big_endian (void); extern bool targhook_float_words_big_endian (void); +extern bool default_float_exceptions_rounding_supported_p (void); extern bool default_decimal_float_supported_p (void); extern bool default_fixed_point_supported_p (void); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad98823..3ebaf82 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-11-04 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/iec-559-macros-1.c, gcc.dg/iec-559-macros-2.c, + gcc.dg/iec-559-macros-3.c, gcc.dg/iec-559-macros-4.c, + gcc.dg/iec-559-macros-5.c, gcc.dg/iec-559-macros-6.c, + gcc.dg/iec-559-macros-7.c, gcc.dg/iec-559-macros-8.c, + gcc.dg/iec-559-macros-9.c: New tests. + 2013-11-04 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/58946 diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-1.c b/gcc/testsuite/gcc.dg/iec-559-macros-1.c new file mode 100644 index 0000000..bd5d037 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-1.c @@ -0,0 +1,16 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-2.c b/gcc/testsuite/gcc.dg/iec-559-macros-2.c new file mode 100644 index 0000000..5a28574 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-2.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-funsafe-math-optimizations" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 != 0 +# error "__GCC_IEC_559 != 0 with -funsafe-math-optimizations" +#endif +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -funsafe-math-optimizations" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-3.c b/gcc/testsuite/gcc.dg/iec-559-macros-3.c new file mode 100644 index 0000000..5eeb34503 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-3.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-freciprocal-math" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 != 0 +# error "__GCC_IEC_559 != 0 with -freciprocal-math" +#endif +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -freciprocal-math" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-4.c b/gcc/testsuite/gcc.dg/iec-559-macros-4.c new file mode 100644 index 0000000..7bf6b9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-4.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-ffinite-math-only" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 != 0 +# error "__GCC_IEC_559 != 0 with -ffinite-math-only" +#endif +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -ffinite-math-only" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-5.c b/gcc/testsuite/gcc.dg/iec-559-macros-5.c new file mode 100644 index 0000000..ea37474 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-5.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-fno-signed-zeros" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 != 0 +# error "__GCC_IEC_559 != 0 with -fno-signed-zeros" +#endif +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -fno-signed-zeros" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-6.c b/gcc/testsuite/gcc.dg/iec-559-macros-6.c new file mode 100644 index 0000000..e2be757 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-6.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-fsingle-precision-constant" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 != 0 +# error "__GCC_IEC_559 != 0 with -fsingle-precision-constant" +#endif +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -fsingle-precision-constant" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-7.c b/gcc/testsuite/gcc.dg/iec-559-macros-7.c new file mode 100644 index 0000000..3b1f791 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-7.c @@ -0,0 +1,20 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-fcx-limited-range" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -fcx-limited-range" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-8.c b/gcc/testsuite/gcc.dg/iec-559-macros-8.c new file mode 100644 index 0000000..1990b94 --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-8.c @@ -0,0 +1,20 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess } */ +/* { dg-options "-fcx-fortran-rules" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559_COMPLEX != 0 +# error "__GCC_IEC_559_COMPLEX != 0 with -fcx-fortran-rules" +#endif diff --git a/gcc/testsuite/gcc.dg/iec-559-macros-9.c b/gcc/testsuite/gcc.dg/iec-559-macros-9.c new file mode 100644 index 0000000..6179a3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/iec-559-macros-9.c @@ -0,0 +1,23 @@ +/* Test __GCC_IEC_559 and __GCC_IEC_559_COMPLEX macros values. */ +/* { dg-do preprocess { target i?86-*-linux* x86_64-*-linux* powerpc*-*-linux* } } */ +/* { dg-options "-std=c11" } */ + +#ifndef __GCC_IEC_559 +# error "__GCC_IEC_559 not defined" +#endif +#ifndef __GCC_IEC_559_COMPLEX +# error "__GCC_IEC_559_COMPLEX not defined" +#endif +#if __GCC_IEC_559_COMPLEX > __GCC_IEC_559 +# error "__GCC_IEC_559_COMPLEX > __GCC_IEC_559" +#endif +#if __GCC_IEC_559_COMPLEX < 0 +# error "__GCC_IEC_559_COMPLEX < 0" +#endif + +#if __GCC_IEC_559 < 2 +# error "__GCC_IEC_559 < 2" +#endif +#if __GCC_IEC_559_COMPLEX < 2 +# error "__GCC_IEC_559_COMPLEX < 2" +#endif |