builtins.def (ATTR_MATHFN_ERRNO, [...]): New macros.

* builtins.def (ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING,
	ATTR_MATHFN_FPROUNDING_ERRNO): New macros.  Use throughout.

From-SVN: r70055
This commit is contained in:
Kaveh R. Ghazi 2003-08-01 17:48:30 +00:00 committed by Kaveh Ghazi
parent 6ab37e1eef
commit ea8eb0b920
2 changed files with 59 additions and 96 deletions

View File

@ -1,3 +1,8 @@
2003-08-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.def (ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING,
ATTR_MATHFN_FPROUNDING_ERRNO): New macros. Use throughout.
2003-08-01 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/s390.c (s390_select_ccmode): Do not attempt to use CCL,

View File

@ -105,6 +105,30 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE, \
true, true, !flag_isoc99, ATTRS, TARGET_C99_FUNCTIONS)
/* Define at attribute list for math functions that are normally
"impure" because some of them may write into global memory for
`errno'. If !flag_errno_math they are instead "const". */
#undef ATTR_MATHFN_ERRNO
#define ATTR_MATHFN_ERRNO (flag_errno_math ? \
ATTR_NOTHROW_LIST : ATTR_CONST_NOTHROW_LIST)
/* Define at attribute list for math functions that are normally
"pure" but if flag_unsafe_math_optimizations is set they are
instead "const". This distinction accounts for the fact that some
math functions check the rounding mode which is akin to examing
global memory. In "unsafe" mode we can be less careful. */
#undef ATTR_MATHFN_FPROUNDING
#define ATTR_MATHFN_FPROUNDING (flag_unsafe_math_optimizations ? \
ATTR_CONST_NOTHROW_LIST : ATTR_PURE_NOTHROW_LIST)
/* Define at attribute list for math functions that are normally
"impure" because some of them may write into global memory for
`errno'. If !flag_errno_math, we can possibly use "pure" or
"const" depending on whether we care about FP rounding. */
#undef ATTR_MATHFN_FPROUNDING_ERRNO
#define ATTR_MATHFN_FPROUNDING_ERRNO (flag_errno_math ? \
ATTR_NOTHROW_LIST : ATTR_MATHFN_FPROUNDING)
DEF_LIB_BUILTIN(BUILT_IN_ABORT,
"__builtin_abort",
@ -144,44 +168,32 @@ DEF_GCC_BUILTIN(BUILT_IN_ARGS_INFO,
DEF_LIB_BUILTIN(BUILT_IN_ATAN,
"__builtin_atan",
BT_FN_DOUBLE_DOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_ATANF,
"__builtin_atanf",
BT_FN_FLOAT_FLOAT,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_ATANL,
"__builtin_atanl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_LIB_BUILTIN(BUILT_IN_ATAN2,
"__builtin_atan2",
BT_FN_DOUBLE_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2F,
"__builtin_atan2f",
BT_FN_FLOAT_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_ATAN2L,
"__builtin_atan2l",
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
/* bcmp has traditionally accepted NULL pointers when the length
parameter is zero, so don't apply attribute "nonnull". */
@ -297,20 +309,17 @@ DEF_GCC_BUILTIN(BUILT_IN_CONSTANT_P,
DEF_LIB_BUILTIN(BUILT_IN_COS,
"__builtin_cos",
BT_FN_DOUBLE_DOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_COSF,
"__builtin_cosf",
BT_FN_FLOAT_FLOAT,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_COSL,
"__builtin_cosl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN(BUILT_IN_CREAL,
"__builtin_creal",
@ -380,26 +389,17 @@ DEF_C99_BUILTIN(BUILT_IN__EXIT2,
DEF_LIB_BUILTIN(BUILT_IN_EXP,
"__builtin_exp",
BT_FN_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPF,
"__builtin_expf",
BT_FN_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_EXPL,
"__builtin_expl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_GCC_BUILTIN(BUILT_IN_EXPECT,
"__builtin_expect",
@ -459,26 +459,17 @@ DEF_C99_C90RES_BUILTIN(BUILT_IN_FLOORL,
DEF_LIB_BUILTIN(BUILT_IN_FMOD,
"__builtin_fmod",
BT_FN_DOUBLE_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODF,
"__builtin_fmodf",
BT_FN_FLOAT_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_FMODL,
"__builtin_fmodl",
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_LIB_BUILTIN(BUILT_IN_FPRINTF,
"__builtin_fprintf",
@ -618,26 +609,17 @@ DEF_C99_BUILTIN(BUILT_IN_LLABS,
DEF_LIB_BUILTIN(BUILT_IN_LOG,
"__builtin_log",
BT_FN_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGF,
"__builtin_logf",
BT_FN_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_LOGL,
"__builtin_logl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_GCC_BUILTIN(BUILT_IN_LONGJMP,
"__builtin_longjmp",
@ -757,26 +739,17 @@ DEF_GCC_BUILTIN(BUILT_IN_POPCOUNTLL,
DEF_LIB_BUILTIN(BUILT_IN_POW,
"__builtin_pow",
BT_FN_DOUBLE_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_POWF,
"__builtin_powf",
BT_FN_FLOAT_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_POWL,
"__builtin_powl",
BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_GCC_BUILTIN(BUILT_IN_PREFETCH,
"__builtin_prefetch",
@ -861,20 +834,17 @@ DEF_GCC_BUILTIN(BUILT_IN_SETJMP,
DEF_LIB_BUILTIN(BUILT_IN_SIN,
"__builtin_sin",
BT_FN_DOUBLE_DOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_SINF,
"__builtin_sinf",
BT_FN_FLOAT_FLOAT,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_SINL,
"__builtin_sinl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN(BUILT_IN_SNPRINTF,
"__builtin_snprintf",
@ -974,44 +944,32 @@ DEF_LIB_BUILTIN(BUILT_IN_STRSTR,
DEF_LIB_BUILTIN(BUILT_IN_SQRT,
"__builtin_sqrt",
BT_FN_DOUBLE_DOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTF,
"__builtin_sqrtf",
BT_FN_FLOAT_FLOAT,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN(BUILT_IN_SQRTL,
"__builtin_sqrtl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_errno_math ? ATTR_NOTHROW_LIST
: (flag_unsafe_math_optimizations
? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST))
ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_LIB_BUILTIN(BUILT_IN_TAN,
"__builtin_tan",
BT_FN_DOUBLE_DOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_TANF,
"__builtin_tanf",
BT_FN_FLOAT_FLOAT,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_C99_C90RES_BUILTIN(BUILT_IN_TANL,
"__builtin_tanl",
BT_FN_LONGDOUBLE_LONGDOUBLE,
flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
: ATTR_PURE_NOTHROW_LIST)
ATTR_MATHFN_FPROUNDING)
DEF_GCC_BUILTIN(BUILT_IN_TRAP,
"__builtin_trap",