On Wed, Jul 14, 2021 at 12:32 AM Matthias Kretz <m.kr...@gsi.de> wrote: > > OK? > > On Wednesday, 30 June 2021 10:59:28 CEST Matthias Kretz wrote: > > Library code, especially in headers, sometimes needs to know how the > > compiler interprets / optimizes floating-point types and operations. > > This information can be used for additional optimizations or for > > ensuring correctness. This change makes -freciprocal-math, > > -fno-signed-zeros, -fno-trapping-math, -fassociative-math, and > > -frounding-math report their state via corresponding pre-defined macros. > > > > Signed-off-by: Matthias Kretz <m.kr...@gsi.de> > > > > gcc/testsuite/ChangeLog: > > > > * gcc.dg/associative-math-1.c: New test. > > * gcc.dg/associative-math-2.c: New test. > > * gcc.dg/no-signed-zeros-1.c: New test. > > * gcc.dg/no-signed-zeros-2.c: New test. > > * gcc.dg/no-trapping-math-1.c: New test. > > * gcc.dg/no-trapping-math-2.c: New test. > > * gcc.dg/reciprocal-math-1.c: New test. > > * gcc.dg/reciprocal-math-2.c: New test. > > * gcc.dg/rounding-math-1.c: New test. > > * gcc.dg/rounding-math-2.c: New test. > > > > gcc/c-family/ChangeLog: > > > > * c-cppbuiltin.c (c_cpp_builtins_optimize_pragma): Define or > > undefine __RECIPROCAL_MATH__, __NO_SIGNED_ZEROS__, > > __NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__, and > > __ROUNDING_MATH__ according to the new optimization flags. > > > > gcc/ChangeLog: > > > > * cppbuiltin.c (define_builtin_macros_for_compilation_flags): > > Define __RECIPROCAL_MATH__, __NO_SIGNED_ZEROS__, > > __NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__, and > > __ROUNDING_MATH__ according to their corresponding flags. > > * doc/cpp.texi: Document __RECIPROCAL_MATH__, > > __NO_SIGNED_ZEROS__, __NO_TRAPPING_MATH__, __ASSOCIATIVE_MATH__, > > and __ROUNDING_MATH__. > > --- > > gcc/c-family/c-cppbuiltin.c | 25 +++++++++++++++++++++++ > > gcc/cppbuiltin.c | 10 +++++++++ > > gcc/doc/cpp.texi | 18 ++++++++++++++++ > > gcc/testsuite/gcc.dg/associative-math-1.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/associative-math-2.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/no-signed-zeros-1.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/no-signed-zeros-2.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/no-trapping-math-1.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/no-trapping-math-2.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/reciprocal-math-1.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/reciprocal-math-2.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/rounding-math-1.c | 17 +++++++++++++++ > > gcc/testsuite/gcc.dg/rounding-math-2.c | 17 +++++++++++++++ > > 13 files changed, 223 insertions(+) > > create mode 100644 gcc/testsuite/gcc.dg/associative-math-1.c > > create mode 100644 gcc/testsuite/gcc.dg/associative-math-2.c > > create mode 100644 gcc/testsuite/gcc.dg/no-signed-zeros-1.c > > create mode 100644 gcc/testsuite/gcc.dg/no-signed-zeros-2.c > > create mode 100644 gcc/testsuite/gcc.dg/no-trapping-math-1.c > > create mode 100644 gcc/testsuite/gcc.dg/no-trapping-math-2.c > > create mode 100644 gcc/testsuite/gcc.dg/reciprocal-math-1.c > > create mode 100644 gcc/testsuite/gcc.dg/reciprocal-math-2.c > > create mode 100644 gcc/testsuite/gcc.dg/rounding-math-1.c > > create mode 100644 gcc/testsuite/gcc.dg/rounding-math-2.c > >
Hi Hongtao, Can this be used to address https://gcc.gnu.org/pipermail/gcc/2021-July/236778.html -- H.J.