diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-12-24 06:52:27 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-12-24 06:52:27 +0000 |
commit | 8f23fc818533a2bbcdec0c35be4312e638abede6 (patch) | |
tree | 2fde402ac6da4c71034ba8c7b11ee7c368e6d234 /gcc | |
parent | ac5fe3fe5198c0529fd777c92eb5aa1f9329ee93 (diff) | |
download | gcc-8f23fc818533a2bbcdec0c35be4312e638abede6.zip gcc-8f23fc818533a2bbcdec0c35be4312e638abede6.tar.gz gcc-8f23fc818533a2bbcdec0c35be4312e638abede6.tar.bz2 |
calls.c (expand_call): Recognize calls to "sqrt" and create corresponding notes.
* calls.c (expand_call): Recognize calls to "sqrt" and create
corresponding notes.
* g++.dg/bprob/bprob.exp: Load target-supports.exp
* g77.dg/bprob/bprob.exp: Likewise.
* gcc.misc-tests/bprob.exp: Likewise.
* gcc.dg/builtins-18.c: Use builtins-config.h. Do not test float
variants on systems where the library does not provide that
functionality.
* gcc.dg/builtins-20.c: Use builtins-config.h.
* gcc.dg/builtins-config.h: New file.
From-SVN: r75003
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/calls.c | 33 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/bprob/bprob.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/g77.dg/bprob/bprob.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-18.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-20.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/builtins-config.h | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/bprob.exp | 2 |
9 files changed, 77 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 10dd567..f1e24bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-12-23 Mark Mitchell <mark@codesourcery.com> + + * calls.c (expand_call): Recognize calls to "sqrt" and create + corresponding notes. + 2003-12-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * config/mips/mips.c (override_options): Use `inform' instead diff --git a/gcc/calls.c b/gcc/calls.c index e589de1..d9a62e7 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3150,22 +3150,33 @@ expand_call (tree exp, rtx target, int ignore) mark_reg_pointer (temp, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp)))); - /* Construct an "equal form" for the value which mentions all the - arguments in order as well as the function name. */ - for (i = 0; i < num_actuals; i++) - note = gen_rtx_EXPR_LIST (VOIDmode, - args[i].initial_value, note); - note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note); - end_sequence (); - - if (flags & ECF_PURE) - note = gen_rtx_EXPR_LIST (VOIDmode, + if (flag_unsafe_math_optimizations + && fndecl + && DECL_BUILT_IN (fndecl) + && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRT + || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTF + || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_SQRTL)) + note = gen_rtx_fmt_e (SQRT, + GET_MODE (temp), + args[0].initial_value); + else + { + /* Construct an "equal form" for the value which + mentions all the arguments in order as well as + the function name. */ + for (i = 0; i < num_actuals; i++) + note = gen_rtx_EXPR_LIST (VOIDmode, + args[i].initial_value, note); + note = gen_rtx_EXPR_LIST (VOIDmode, funexp, note); + + if (flags & ECF_PURE) + note = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))), note); - + } emit_libcall_block (insns, temp, valreg, note); valreg = temp; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f1558a7..e0086f4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,16 @@ 2003-12-23 Mark Mitchell <mark@codesourcery.com> + * g++.dg/bprob/bprob.exp: Load target-supports.exp + * g77.dg/bprob/bprob.exp: Likewise. + * gcc.misc-tests/bprob.exp: Likewise. + * gcc.dg/builtins-18.c: Use builtins-config.h. Do not test float + variants on systems where the library does not provide that + functionality. + * gcc.dg/builtins-20.c: Use builtins-config.h. + * gcc.dg/builtins-config.h: New file. + +2003-12-23 Mark Mitchell <mark@codesourcery.com> + * lib/gcc-dg.exp (dg-require-profiling): New function. * lib/target-supports.exp (check_profiling_available): Likewise. * g++.dg/bprob/bprob.exp: Use check_profiling_available. diff --git a/gcc/testsuite/g++.dg/bprob/bprob.exp b/gcc/testsuite/g++.dg/bprob/bprob.exp index 35bec33..bef5783 100644 --- a/gcc/testsuite/g++.dg/bprob/bprob.exp +++ b/gcc/testsuite/g++.dg/bprob/bprob.exp @@ -17,6 +17,8 @@ # Test the functionality of programs compiled with profile-directed block # ordering using -fprofile-arcs followed by -fbranch-probabilities. +load_lib target-supports.exp + # Some targets don't have any implementation of __bb_init_func or are # missing other needed machinery. if { ![check_profiling_available] } { diff --git a/gcc/testsuite/g77.dg/bprob/bprob.exp b/gcc/testsuite/g77.dg/bprob/bprob.exp index e30234e..6eb45be 100644 --- a/gcc/testsuite/g77.dg/bprob/bprob.exp +++ b/gcc/testsuite/g77.dg/bprob/bprob.exp @@ -17,6 +17,8 @@ # Test the functionality of programs compiled with profile-directed block # ordering using -fprofile-arcs followed by -fbranch-probabilities. +load_lib target-supports.exp + # Some targets don't have any implementation of __bb_init_func or are # missing other needed machinery. if { ![check_profiling_available] } { diff --git a/gcc/testsuite/gcc.dg/builtins-18.c b/gcc/testsuite/gcc.dg/builtins-18.c index 07b9418..a47de8b 100644 --- a/gcc/testsuite/gcc.dg/builtins-18.c +++ b/gcc/testsuite/gcc.dg/builtins-18.c @@ -8,11 +8,7 @@ /* { dg-do link } */ /* { dg-options "-O2 -ffast-math" } */ - -/* Solaris doesn't have the entire C99 runtime. */ -#if !defined(sun) -#define HAVE_C99_RUNTIME -#endif +#include "builtins-config.h" extern void link_error(void); @@ -29,6 +25,7 @@ main (void) double _Complex dc = 3.0 + 4.0i; long double _Complex ldc = 3.0L + 4.0iL; +#ifdef HAVE_C99_RUNTIME /* Test floats. */ if (cabsf (fc) != 5.0F) link_error (); @@ -38,6 +35,7 @@ main (void) link_failure (); if (__builtin_cabsf (3.0F + 4.0iF) != 5.0F) link_failure (); +#endif /* Test doubles. */ if (cabs (dc) != 5.0) diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c index b633c55..1bd9534 100644 --- a/gcc/testsuite/gcc.dg/builtins-20.c +++ b/gcc/testsuite/gcc.dg/builtins-20.c @@ -8,11 +8,7 @@ /* { dg-do link } */ /* { dg-options "-O2 -ffast-math" } */ - -/* Solaris doesn't have the entire C99 runtime. */ -#if !defined(sun) -#define HAVE_C99_RUNTIME -#endif +#include "builtins-config.h" extern void link_error(void); diff --git a/gcc/testsuite/gcc.dg/builtins-config.h b/gcc/testsuite/gcc.dg/builtins-config.h new file mode 100644 index 0000000..11f7c11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtins-config.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2003 Free Software Foundation. + + Define macros useful in tests for bulitin functions. */ + +/* Define HAVE_C99_RUNTIME if the entire C99 runtime is available on + the target system. The value of HAVE_C99_RUNTIME should be the + same as the value of TARGET_C99_FUNCTIONS in the GCC machine + description. (Perhaps GCC should predefine a special macro + indicating whether or not TARGET_C99_FUNCTIONS is set, but it does + not presently do that.) */ + +#if defined(sun) +/* Solaris doesn't have the entire C99 runtime. */ +#else +/* Newlib has the "f" variants of the math functions, but not the "l" + variants. TARGET_C99_FUNCTIONS is only defined if all C99 + functions are present. Therefore, on systems using newlib, tests + of builtins will fail for both the "f" and the "l" variants, and we + should therefore not define HAVE_C99_RUNTIME. Including <limits.h> + gives us a way of seeing if _NEWLIB_VERSION is defined. Include + <math.h> would work too, but the GLIBC math inlines cause us to + generate inferior code, which causes the test to fail, so it is + not safe to include <math.h>. */ +#include <limits.h> +#ifdef _NEWLIB_VERSION +#else +#define HAVE_C99_RUNTIME +#endif +#endif diff --git a/gcc/testsuite/gcc.misc-tests/bprob.exp b/gcc/testsuite/gcc.misc-tests/bprob.exp index df59900..5afbdb1 100644 --- a/gcc/testsuite/gcc.misc-tests/bprob.exp +++ b/gcc/testsuite/gcc.misc-tests/bprob.exp @@ -17,6 +17,8 @@ # Test the functionality of programs compiled with profile-directed block # ordering using -fprofile-arcs followed by -fbranch-probabilities. +load_lib target-supports.exp + # Some targets don't have any implementation of __bb_init_func or are # missing other needed machinery. if { ![check_profiling_available] } { |