aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2005-02-11 16:26:57 -0800
committerRichard Henderson <rth@gcc.gnu.org>2005-02-11 16:26:57 -0800
commit7e7e470f9bf455553ee08e9be90943fa3631a07b (patch)
treed07cd0c8b8b5189a1a0ffc5396fe8bf7003febf4 /gcc/c-common.c
parent17e1f1a36faa0f8a07de8b5b7b9a4eb27df96399 (diff)
downloadgcc-7e7e470f9bf455553ee08e9be90943fa3631a07b.zip
gcc-7e7e470f9bf455553ee08e9be90943fa3631a07b.tar.gz
gcc-7e7e470f9bf455553ee08e9be90943fa3631a07b.tar.bz2
tree-complex.c (expand_complex_libcall): New.
* 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. From-SVN: r94909
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 15f3648..b414915 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1611,7 +1611,27 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp)
if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode);
- if (VECTOR_MODE_P (mode))
+ if (COMPLEX_MODE_P (mode))
+ {
+ enum machine_mode inner_mode;
+ tree inner_type;
+
+ if (mode == TYPE_MODE (complex_float_type_node))
+ return complex_float_type_node;
+ if (mode == TYPE_MODE (complex_double_type_node))
+ return complex_double_type_node;
+ if (mode == TYPE_MODE (complex_long_double_type_node))
+ return complex_long_double_type_node;
+
+ if (mode == TYPE_MODE (complex_integer_type_node) && !unsignedp)
+ return complex_integer_type_node;
+
+ inner_mode = GET_MODE_INNER (mode);
+ inner_type = c_common_type_for_mode (inner_mode, unsignedp);
+ if (inner_type != NULL_TREE)
+ return build_complex_type (inner_type);
+ }
+ else if (VECTOR_MODE_P (mode))
{
enum machine_mode inner_mode = GET_MODE_INNER (mode);
tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);