summaryrefslogtreecommitdiff
path: root/gcc/builtins.def
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-01 17:48:30 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2003-08-01 17:48:30 +0000
commita2d4c3364a9dad62292588271ab7c6faa64009ea (patch)
tree8347c0c7d137da1f16b06e117933981e1b26746d /gcc/builtins.def
parent231e9f2832dc9922b3858a553eebadcf3307c373 (diff)
downloadgcc-a2d4c3364a9dad62292588271ab7c6faa64009ea.tar.gz
* builtins.def (ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING,
ATTR_MATHFN_FPROUNDING_ERRNO): New macros. Use throughout. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70055 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.def')
-rw-r--r--gcc/builtins.def150
1 files changed, 54 insertions, 96 deletions
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 71202462cdb..32bea772c01 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -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",