diff options
author | Matt Austern <austern@apple.com> | 2004-12-20 20:11:41 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2004-12-20 20:11:41 +0000 |
commit | b482789cca42c2e1c3d0c7dd1c140fe3e5e320a2 (patch) | |
tree | a8c54e7d5be9f8fb754934d667e66e6346bf3f62 | |
parent | 90e34bd6374760bfdd0a8807e8323eaa50a749f1 (diff) | |
download | gcc-b482789cca42c2e1c3d0c7dd1c140fe3e5e320a2.zip gcc-b482789cca42c2e1c3d0c7dd1c140fe3e5e320a2.tar.gz gcc-b482789cca42c2e1c3d0c7dd1c140fe3e5e320a2.tar.bz2 |
re PR c++/19044 (Alternate asm name for atan ignored when calling __builtin_atan)
PR c++/19044
* c-common.c (set_builtin_user_assembler_name): New.
* c-common.h (set_builtin_user_assembler_name): Declare.
* c-decl.c (finish_decl): Use set_builtin_user_assembler_name
* decl.c (make_rtl_for_nonlocal_decl): Use set_builtin_user_assembler_name
* g++.dg/ext/builtin6.C: New
From-SVN: r92428
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-common.c | 20 | ||||
-rw-r--r-- | gcc/c-common.h | 2 | ||||
-rw-r--r-- | gcc/c-decl.c | 9 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/builtin6.C | 11 |
8 files changed, 57 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08bcedd..db153d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-12-20 Matt Austern <austern@apple.com> + + PR c++/19044 + * c-common.c (set_builtin_user_assembler_name): New. + * c-common.h (set_builtin_user_assembler_name): Declare. + * c-decl.c (finish_decl): Use set_builtin_user_assembler_name + 2004-12-20 Diego Novillo <dnovillo@redhat.com> PR tree-optimization/19080 diff --git a/gcc/c-common.c b/gcc/c-common.c index bf48029..b4c6349 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -3223,6 +3223,26 @@ c_common_nodes_and_builtins (void) main_identifier_node = get_identifier ("main"); } +/* Look up the function in built_in_decls that corresponds to DECL + and set ASMSPEC as its user assembler name. DECL must be a + function decl that declares a builtin. */ + +void +set_builtin_user_assembler_name (tree decl, const char *asmspec) +{ + tree builtin; + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL + && asmspec != 0); + + builtin = built_in_decls [DECL_FUNCTION_CODE (decl)]; + set_user_assembler_name (builtin, asmspec); + if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY) + init_block_move_fn (asmspec); + else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMSET) + init_block_clear_fn (asmspec); +} + tree build_va_arg (tree expr, tree type) { diff --git a/gcc/c-common.h b/gcc/c-common.h index d0fbaa8..8ebc560 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -674,6 +674,8 @@ extern tree c_build_qualified_type (tree, int); frontends. */ extern void c_common_nodes_and_builtins (void); +extern void set_builtin_user_assembler_name (tree decl, const char *asmspec); + extern void disable_builtin_function (const char *); extern tree build_va_arg (tree, tree); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e6b4cba..97420d1 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3233,14 +3233,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree) if (TREE_CODE (decl) == FUNCTION_DECL && asmspec) { if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) - { - tree builtin = built_in_decls [DECL_FUNCTION_CODE (decl)]; - set_user_assembler_name (builtin, asmspec); - if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY) - init_block_move_fn (asmspec); - else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMSET) - init_block_clear_fn (asmspec); - } + set_builtin_user_assembler_name (decl, asmspec); set_user_assembler_name (decl, asmspec); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 57affb0..ac2a9ab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-12-20 Matt Austern <austern@apple.com> + + PR c++/19044 + * decl.c (make_rtl_for_nonlocal_decl): Use set_builtin_user_assembler_name + 2004-12-19 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (note_decl_for_pch): New function. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 01a3312..dbaf23e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4644,7 +4644,12 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) DECL_HARD_REGISTER (decl) = 1; } else - set_user_assembler_name (decl, asmspec); + { + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) + set_builtin_user_assembler_name (decl, asmspec); + set_user_assembler_name (decl, asmspec); + } } /* Handle non-variables up front. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5dfec5c..19bbb9a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-12-20 Matt Austern <austern@apple.com> + + PR c++/19044 + * g++.dg/ext/builtin6.C: New + 2004-12-20 Diego Novillo <dnovillo@redhat.com> PR tree-optimization/19080 diff --git a/gcc/testsuite/g++.dg/ext/builtin6.C b/gcc/testsuite/g++.dg/ext/builtin6.C new file mode 100644 index 0000000..8f405b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/builtin6.C @@ -0,0 +1,11 @@ +// PR c++/19044 +// Verify that alternate asm name for builtin named "foo" also gets +// applied to its sibling "__builtin_foo". + +// { dg-do compile } +// { dg-final { scan-assembler "fancy_sin" } } + +extern "C" double sin(double) __asm("_fancy_sin"); + +double foo(double x) { return __builtin_sin(x); } + |