diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-12 00:26:57 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-12 00:26:57 +0000 |
commit | 0dfc45b5614725c49ee4d16ad5cd04dde5fb1912 (patch) | |
tree | d07cd0c8b8b5189a1a0ffc5396fe8bf7003febf4 /gcc/tree.c | |
parent | 94a53c2d0659a2871fb6c3df953df115a1673d04 (diff) | |
download | gcc-0dfc45b5614725c49ee4d16ad5cd04dde5fb1912.tar.gz |
* tree-complex.c (expand_complex_libcall): New.
(expand_complex_multiplication): Use it for c99 compliance.
(expand_complex_division): Likewise.
* fold-const.c (fold_complex_add, fold_complex_mult): New.
(fold): Call them.
* builtins.c (built_in_names): Remove const.
* tree.c (build_common_builtin_nodes): Build complex arithmetic
builtins.
* tree.h (BUILT_IN_COMPLEX_MUL_MIN, BUILT_IN_COMPLEX_MUL_MAX): New.
(BUILT_IN_COMPLEX_DIV_MIN, BUILT_IN_COMPLEX_DIV_MAX): New.
(built_in_names): Remove const.
* c-common.c (c_common_type_for_mode): Handle complex modes.
* flags.h, toplev.c (flag_complex_method): Rename from
flag_complex_divide_method.
* libgcc2.c (__divsc3, __divdc3, __divxc3, __divtc3,
__mulsc3, __muldc3, __mulxc3, __multc3): New.
* libgcc2.h: Declare them.
* libgcc-std.ver: Export them.
* mklibgcc.in (lib2funcs): Build them.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94909 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index 3d41e114342..3a0054c507e 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5903,6 +5903,48 @@ build_common_builtin_nodes (void) BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter", 0); local_define_builtin ("__builtin_profile_func_exit", ftype, BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0); + + /* Complex multiplication and division. These are handled as builtins + rather than optabs because emit_library_call_value doesn't support + complex. Further, we can do slightly better with folding these + beasties if the real and complex parts of the arguments are separate. */ + { + enum machine_mode mode; + + for (mode = MIN_MODE_COMPLEX_FLOAT; mode <= MAX_MODE_COMPLEX_FLOAT; ++mode) + { + char mode_name_buf[4], *q; + const char *p; + enum built_in_function mcode, dcode; + tree type, inner_type; + + type = lang_hooks.types.type_for_mode (mode, 0); + if (type == NULL) + continue; + inner_type = TREE_TYPE (type); + + tmp = tree_cons (NULL_TREE, inner_type, void_list_node); + tmp = tree_cons (NULL_TREE, inner_type, tmp); + tmp = tree_cons (NULL_TREE, inner_type, tmp); + tmp = tree_cons (NULL_TREE, inner_type, tmp); + ftype = build_function_type (type, tmp); + + mcode = BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT; + dcode = BUILT_IN_COMPLEX_DIV_MIN + mode - MIN_MODE_COMPLEX_FLOAT; + + for (p = GET_MODE_NAME (mode), q = mode_name_buf; *p; p++, q++) + *q = TOLOWER (*p); + *q = '\0'; + + built_in_names[mcode] = concat ("__mul", mode_name_buf, "3", NULL); + local_define_builtin (built_in_names[mcode], ftype, mcode, + built_in_names[mcode], ECF_CONST | ECF_NOTHROW); + + built_in_names[dcode] = concat ("__div", mode_name_buf, "3", NULL); + local_define_builtin (built_in_names[dcode], ftype, dcode, + built_in_names[dcode], ECF_CONST | ECF_NOTHROW); + } + } } /* HACK. GROSS. This is absolutely disgusting. I wish there was a |