diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-05 18:24:08 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-05 18:24:08 +0000 |
commit | d30e4d0464cae3e2ef4ca79006784aec74d2a9e5 (patch) | |
tree | cae858fa1cc9c29db5a7d0166db607c208716c6e /gcc/c-common.c | |
parent | 4405d2305aa3bdcc6e306968be66eb002b96ad43 (diff) | |
download | gcc-d30e4d0464cae3e2ef4ca79006784aec74d2a9e5.tar.gz |
* builtins.def (BUILT_IN_CONJ, BUILT_IN_CREAL, BUILT_IN_CIMAG):
Define.
* builtins.c (expand_builtin): Abort on BUILT_IN_CONJ,
BUILT_IN_CREAL and BUILT_IN_CIMAG.
* c-common.c (c_common_nodes_and_builtins): Create builtin conjf,
conj, conjl, crealf, creal, creall, cimagf, cimag and cimagl.
(expand_tree_builtin): Handle BUILT_IN_CONJ, BUILT_IN_CREAL and
BUILT_IN_CIMAG.
* extend.texi: Document these builtins.
testsuite:
* gcc.c-torture/execute/builtin-complex-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38716 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 032837300ba..1e36874190c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5134,6 +5134,8 @@ c_common_nodes_and_builtins () tree void_ftype_any, void_ftype_int, int_ftype_any; tree double_ftype_double, double_ftype_double_double; tree float_ftype_float, ldouble_ftype_ldouble; + tree cfloat_ftype_cfloat, cdouble_ftype_cdouble, cldouble_ftype_cldouble; + tree float_ftype_cfloat, double_ftype_cdouble, ldouble_ftype_cldouble; tree int_ftype_cptr_cptr_sizet, sizet_ftype_cstring_cstring; tree int_ftype_cstring_cstring, string_ftype_string_cstring; tree string_ftype_cstring_int, string_ftype_cstring_cstring; @@ -5358,6 +5360,32 @@ c_common_nodes_and_builtins () tree_cons (NULL_TREE, double_type_node, double_endlink)); + cfloat_ftype_cfloat + = build_function_type (complex_float_type_node, + tree_cons (NULL_TREE, complex_float_type_node, + endlink)); + cdouble_ftype_cdouble + = build_function_type (complex_double_type_node, + tree_cons (NULL_TREE, complex_double_type_node, + endlink)); + cldouble_ftype_cldouble + = build_function_type (complex_long_double_type_node, + tree_cons (NULL_TREE, complex_long_double_type_node, + endlink)); + + float_ftype_cfloat + = build_function_type (float_type_node, + tree_cons (NULL_TREE, complex_float_type_node, + endlink)); + double_ftype_cdouble + = build_function_type (double_type_node, + tree_cons (NULL_TREE, complex_double_type_node, + endlink)); + ldouble_ftype_cldouble + = build_function_type (long_double_type_node, + tree_cons (NULL_TREE, complex_long_double_type_node, + endlink)); + int_ftype_int = build_function_type (integer_type_node, int_endlink); @@ -5748,6 +5776,36 @@ c_common_nodes_and_builtins () builtin_function_2 ("__builtin_cosl", "cosl", ldouble_ftype_ldouble, ldouble_ftype_ldouble, BUILT_IN_COS, BUILT_IN_NORMAL, 1, 0, 0); + + /* ISO C99 complex arithmetic functions. */ + builtin_function_2 ("__builtin_conjf", "conjf", + cfloat_ftype_cfloat, cfloat_ftype_cfloat, + BUILT_IN_CONJ, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_conj", "conj", + cdouble_ftype_cdouble, cdouble_ftype_cdouble, + BUILT_IN_CONJ, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_conjl", "conjl", + cldouble_ftype_cldouble, cldouble_ftype_cldouble, + BUILT_IN_CONJ, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_crealf", "crealf", + float_ftype_cfloat, float_ftype_cfloat, + BUILT_IN_CREAL, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_creal", "creal", + double_ftype_cdouble, double_ftype_cdouble, + BUILT_IN_CREAL, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_creall", "creall", + ldouble_ftype_cldouble, ldouble_ftype_cldouble, + BUILT_IN_CREAL, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_cimagf", "cimagf", + float_ftype_cfloat, float_ftype_cfloat, + BUILT_IN_CIMAG, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_cimag", "cimag", + double_ftype_cdouble, double_ftype_cdouble, + BUILT_IN_CIMAG, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + builtin_function_2 ("__builtin_cimagl", "cimagl", + ldouble_ftype_cldouble, ldouble_ftype_cldouble, + BUILT_IN_CIMAG, BUILT_IN_NORMAL, 0, !flag_isoc99, 0); + built_in_decls[BUILT_IN_PUTCHAR] = builtin_function ("__builtin_putchar", int_ftype_int, BUILT_IN_PUTCHAR, BUILT_IN_NORMAL, "putchar"); @@ -5967,6 +6025,21 @@ expand_tree_builtin (function, params, coerced_params) return integer_zero_node; return build_unary_op (ABS_EXPR, TREE_VALUE (coerced_params), 0); + case BUILT_IN_CONJ: + if (coerced_params == 0) + return integer_zero_node; + return build_unary_op (CONJ_EXPR, TREE_VALUE (coerced_params), 0); + + case BUILT_IN_CREAL: + if (coerced_params == 0) + return integer_zero_node; + return build_unary_op (REALPART_EXPR, TREE_VALUE (coerced_params), 0); + + case BUILT_IN_CIMAG: + if (coerced_params == 0) + return integer_zero_node; + return build_unary_op (IMAGPART_EXPR, TREE_VALUE (coerced_params), 0); + case BUILT_IN_ISGREATER: if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT) code = UNLE_EXPR; |