Commit e78f4a97 by Joseph Myers Committed by Joseph Myers

builtins.def (BUILT_IN_IMAXABS): Add.

	* builtins.def (BUILT_IN_IMAXABS): Add.
	* builtins.c (expand_builtin): Also abort on BUILT_IN_IMAXABS.
	* c-common.c (c_common_nodes_and_builtins): Create builtin
	functions __builtin_imaxabs, and plain imaxabs unless
	flag_no_nonansi_builtin outside C99 mode.
	(expand_tree_builtin): Handle BUILT_IN_IMAXABS.
	* extend.texi: Document builtin imaxabs.

From-SVN: r37932
parent 5fd8e536
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk> 2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* builtins.def (BUILT_IN_IMAXABS): Add.
* builtins.c (expand_builtin): Also abort on BUILT_IN_IMAXABS.
* c-common.c (c_common_nodes_and_builtins): Create builtin
functions __builtin_imaxabs, and plain imaxabs unless
flag_no_nonansi_builtin outside C99 mode.
(expand_tree_builtin): Handle BUILT_IN_IMAXABS.
* extend.texi: Document builtin imaxabs.
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c: Include "defaults.h". * c-common.c: Include "defaults.h".
(WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define. (WINT_TYPE, INTMAX_TYPE, UINTMAX_TYPE): Define.
(c_common_nodes_and_builtins): Create string_type_node, (c_common_nodes_and_builtins): Create string_type_node,
......
...@@ -3098,6 +3098,7 @@ expand_builtin (exp, target, subtarget, mode, ignore) ...@@ -3098,6 +3098,7 @@ expand_builtin (exp, target, subtarget, mode, ignore)
case BUILT_IN_ABS: case BUILT_IN_ABS:
case BUILT_IN_LABS: case BUILT_IN_LABS:
case BUILT_IN_LLABS: case BUILT_IN_LLABS:
case BUILT_IN_IMAXABS:
case BUILT_IN_FABS: case BUILT_IN_FABS:
/* build_function_call changes these into ABS_EXPR. */ /* build_function_call changes these into ABS_EXPR. */
abort (); abort ();
......
...@@ -24,6 +24,7 @@ DEF_BUILTIN(BUILT_IN_ABS) ...@@ -24,6 +24,7 @@ DEF_BUILTIN(BUILT_IN_ABS)
DEF_BUILTIN(BUILT_IN_FABS) DEF_BUILTIN(BUILT_IN_FABS)
DEF_BUILTIN(BUILT_IN_LABS) DEF_BUILTIN(BUILT_IN_LABS)
DEF_BUILTIN(BUILT_IN_LLABS) DEF_BUILTIN(BUILT_IN_LLABS)
DEF_BUILTIN(BUILT_IN_IMAXABS)
DEF_BUILTIN(BUILT_IN_FFS) DEF_BUILTIN(BUILT_IN_FFS)
DEF_BUILTIN(BUILT_IN_DIV) DEF_BUILTIN(BUILT_IN_DIV)
DEF_BUILTIN(BUILT_IN_LDIV) DEF_BUILTIN(BUILT_IN_LDIV)
......
...@@ -4911,6 +4911,7 @@ c_common_nodes_and_builtins () ...@@ -4911,6 +4911,7 @@ c_common_nodes_and_builtins ()
tree string_ftype_string_cstring_sizet, int_ftype_cstring_cstring_sizet; tree string_ftype_string_cstring_sizet, int_ftype_cstring_cstring_sizet;
tree long_ftype_long; tree long_ftype_long;
tree longlong_ftype_longlong; tree longlong_ftype_longlong;
tree intmax_ftype_intmax;
/* Either char* or void*. */ /* Either char* or void*. */
tree traditional_ptr_type_node; tree traditional_ptr_type_node;
/* Either const char* or const void*. */ /* Either const char* or const void*. */
...@@ -5007,6 +5008,11 @@ c_common_nodes_and_builtins () ...@@ -5007,6 +5008,11 @@ c_common_nodes_and_builtins ()
tree_cons (NULL_TREE, long_long_integer_type_node, tree_cons (NULL_TREE, long_long_integer_type_node,
endlink)); endlink));
intmax_ftype_intmax
= build_function_type (intmax_type_node,
tree_cons (NULL_TREE, intmax_type_node,
endlink));
int_ftype_cptr_cptr_sizet int_ftype_cptr_cptr_sizet
= build_function_type (integer_type_node, = build_function_type (integer_type_node,
tree_cons (NULL_TREE, const_ptr_type_node, tree_cons (NULL_TREE, const_ptr_type_node,
...@@ -5190,6 +5196,8 @@ c_common_nodes_and_builtins () ...@@ -5190,6 +5196,8 @@ c_common_nodes_and_builtins ()
BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("__builtin_llabs", longlong_ftype_longlong, BUILT_IN_LLABS, builtin_function ("__builtin_llabs", longlong_ftype_longlong, BUILT_IN_LLABS,
BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("__builtin_imaxabs", intmax_ftype_intmax, BUILT_IN_IMAXABS,
BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("__builtin_saveregs", ptr_ftype, BUILT_IN_SAVEREGS, builtin_function ("__builtin_saveregs", ptr_ftype, BUILT_IN_SAVEREGS,
BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("__builtin_classify_type", default_function_type, builtin_function ("__builtin_classify_type", default_function_type,
...@@ -5375,8 +5383,12 @@ c_common_nodes_and_builtins () ...@@ -5375,8 +5383,12 @@ c_common_nodes_and_builtins ()
builtin_function ("labs", long_ftype_long, BUILT_IN_LABS, builtin_function ("labs", long_ftype_long, BUILT_IN_LABS,
BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_NORMAL, NULL_PTR);
if (flag_isoc99 || ! flag_no_nonansi_builtin) if (flag_isoc99 || ! flag_no_nonansi_builtin)
builtin_function ("llabs", longlong_ftype_longlong, BUILT_IN_LLABS, {
BUILT_IN_NORMAL, NULL_PTR); builtin_function ("llabs", longlong_ftype_longlong, BUILT_IN_LLABS,
BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("imaxabs", intmax_ftype_intmax, BUILT_IN_IMAXABS,
BUILT_IN_NORMAL, NULL_PTR);
}
builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY, builtin_function ("memcpy", memcpy_ftype, BUILT_IN_MEMCPY,
BUILT_IN_NORMAL, NULL_PTR); BUILT_IN_NORMAL, NULL_PTR);
builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP, builtin_function ("memcmp", int_ftype_cptr_cptr_sizet, BUILT_IN_MEMCMP,
...@@ -5573,6 +5585,7 @@ expand_tree_builtin (function, params, coerced_params) ...@@ -5573,6 +5585,7 @@ expand_tree_builtin (function, params, coerced_params)
case BUILT_IN_ABS: case BUILT_IN_ABS:
case BUILT_IN_LABS: case BUILT_IN_LABS:
case BUILT_IN_LLABS: case BUILT_IN_LLABS:
case BUILT_IN_IMAXABS:
case BUILT_IN_FABS: case BUILT_IN_FABS:
if (coerced_params == 0) if (coerced_params == 0)
return integer_zero_node; return integer_zero_node;
......
...@@ -3296,6 +3296,7 @@ function as well. ...@@ -3296,6 +3296,7 @@ function as well.
@findex fabsl @findex fabsl
@findex ffs @findex ffs
@findex fputs @findex fputs
@findex imaxabs
@findex index @findex index
@findex labs @findex labs
@findex llabs @findex llabs
...@@ -3348,7 +3349,8 @@ as builtins. Corresponding versions @code{__builtin_alloca}, ...@@ -3348,7 +3349,8 @@ as builtins. Corresponding versions @code{__builtin_alloca},
@code{__builtin_rindex} and @code{__builtin_ffs} are also recognized in @code{__builtin_rindex} and @code{__builtin_ffs} are also recognized in
strict ISO C mode. strict ISO C mode.
The ISO C99 function @code{llabs} is handled as a builtin except in The ISO C99 functions @code{llabs} and @code{imaxabs}
are handled as builtins except in
strict ISO C89 mode. There are also builtin versions of the ISO C99 strict ISO C89 mode. There are also builtin versions of the ISO C99
functions @code{cosf}, @code{cosl}, @code{fabsf}, @code{fabsl}, functions @code{cosf}, @code{cosl}, @code{fabsf}, @code{fabsl},
@code{sinf}, @code{sinl}, @code{sqrtf}, and @code{sqrtl}, that are @code{sinf}, @code{sinl}, @code{sqrtf}, and @code{sqrtl}, that are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment