From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
To: egcs@cygnus.com
Subject: abs/fabs/labs not builtin in C++
Date: Wed, 10 Dec 1997 02:27:00 -0000 [thread overview]
Message-ID: <vyzyb1tcxne.fsf@issan.informatik.uni-dortmund.de> (raw)
Why are abs, labs and fabs not builtins in C++? A comment in cp/decl.c
claims they don't work with libg++, but i could not find any problems
after enabling them, and libg++ is obsolete anyway.
1997-12-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* call.c (build_over_call): Convert builtin abs, labs and fabs to
tree-codes.
* decl.c (init_decl_processing): Reenable abs, labs and fabs as
builtins.
*** egcs-971207/gcc/cp/call.c.~1~ Tue Dec 9 00:33:39 1997
--- egcs-971207/gcc/cp/call.c Tue Dec 9 11:24:31 1997
*************** build_over_call (fn, convs, args, flags)
*** 5591,5596 ****
--- 5591,5613 ----
else
fn = build_addr_func (fn);
+ /* Recognize certain built-in functions so we can make tree-codes
+ other than CALL_EXPR. We do this when it enables fold-const.c
+ to do something useful. */
+
+ if (TREE_CODE (fn) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fn, 0)) == FUNCTION_DECL
+ && DECL_BUILT_IN (TREE_OPERAND (fn, 0)))
+ switch (DECL_FUNCTION_CODE (TREE_OPERAND (fn, 0)))
+ {
+ case BUILT_IN_ABS:
+ case BUILT_IN_LABS:
+ case BUILT_IN_FABS:
+ if (converted_args == 0)
+ return integer_zero_node;
+ return build_unary_op (ABS_EXPR, TREE_VALUE (converted_args), 0);
+ }
+
fn = build_call (fn, TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))), converted_args);
if (TREE_TYPE (fn) == void_type_node)
return fn;
*** egcs-971207/gcc/cp/decl.c.~1~ Tue Dec 9 00:33:58 1997
--- egcs-971207/gcc/cp/decl.c Tue Dec 9 11:23:39 1997
*************** init_decl_processing ()
*** 5263,5273 ****
if (!flag_no_builtin)
{
- #if 0 /* These do not work well with libg++. */
builtin_function ("abs", int_ftype_int, BUILT_IN_ABS, NULL_PTR);
builtin_function ("fabs", double_ftype_double, BUILT_IN_FABS, NULL_PTR);
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, NULL_PTR);
- #endif
builtin_function ("fabsf", float_ftype_float, BUILT_IN_FABS, NULL_PTR);
builtin_function ("fabsl", ldouble_ftype_ldouble, BUILT_IN_FABS,
NULL_PTR);
--- 5263,5271 ----
next reply other threads:[~1997-12-10 2:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-10 2:27 Andreas Schwab [this message]
1997-12-10 10:30 ` Richard Henderson
1997-12-10 10:58 ` Joe Buck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vyzyb1tcxne.fsf@issan.informatik.uni-dortmund.de \
--to=schwab@issan.informatik.uni-dortmund.de \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).