From e7b489c8c091c2210c01bcd35b9c7cdd2d6b559a Mon Sep 17 00:00:00 2001
From: Roger Sayle <roger@eyesopen.com>
Date: Sat, 3 Aug 2002 23:21:31 +0000
Subject: builtins.def: Define new builtin functions exp...

	* builtins.def: Define new builtin functions exp, expf, expl,
	log, logf and logl (and their __builtin_* variants).
	* optabs.h (enum optab_index): Add new OTI_exp and OTI_log.
	Define exp_optab and log_optab.
	* optabs.c (init_optans): Initialize exp_optab and log_optab.
	* genopinit.c (optabs): Implement exp_optab and log_optab
	using exp?f2 and log?f2 patterns.
	* builtins.c (expand_builtin_mathfn): Handle BUILT_IN_EXP*
	and BUILT_IN_LOG* using exp_optab and log_optab respectively.
	(expand_builtin): Ignore the new builtins (and all cos and
	sin variants) when not optimizing.  Expand new builtins via
	expand_builtin_mathfn when flag_unsafe_math_optimizations.

	* doc/extend.texi: Document new exp and log builtins.
	* doc/md.texi: Document new exp?f2 and log?f2 patterns
	(and previously undocumented cos?f2 and sin?f2 patterns).

From-SVN: r56010
---
 gcc/builtins.def | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

(limited to 'gcc/builtins.def')

diff --git a/gcc/builtins.def b/gcc/builtins.def
index 7be8fe1..978b4a7 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -324,6 +324,20 @@ DEF_LIB_BUILTIN(BUILT_IN_COS,
 		BT_FN_DOUBLE_DOUBLE,
 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
 					       : ATTR_PURE_NOTHROW_LIST)
+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))
+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))
 DEF_LIB_BUILTIN(BUILT_IN_SQRTF,
 		"__builtin_sqrtf",
 		BT_FN_FLOAT_FLOAT,
@@ -341,6 +355,20 @@ DEF_LIB_BUILTIN(BUILT_IN_COSF,
 		BT_FN_FLOAT_FLOAT,
 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
 					       : ATTR_PURE_NOTHROW_LIST)
+DEF_LIB_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))
+DEF_LIB_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))
 DEF_LIB_BUILTIN(BUILT_IN_SQRTL,
 		"__builtin_sqrtl",
 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
@@ -358,6 +386,20 @@ DEF_LIB_BUILTIN(BUILT_IN_COSL,
 		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
 		flag_unsafe_math_optimizations ? ATTR_CONST_NOTHROW_LIST
 					       : ATTR_PURE_NOTHROW_LIST)
+DEF_LIB_BUILTIN(BUILT_IN_EXPL,
+		"__builtin_expl",
+		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+		flag_errno_math ? ATTR_NOTHROW_LIST
+				: (flag_unsafe_math_optimizations
+				   ? ATTR_CONST_NOTHROW_LIST
+				   : ATTR_PURE_NOTHROW_LIST))
+DEF_LIB_BUILTIN(BUILT_IN_LOGL,
+		"__builtin_logl",
+		BT_FN_LONG_DOUBLE_LONG_DOUBLE,
+		flag_errno_math ? ATTR_NOTHROW_LIST
+				: (flag_unsafe_math_optimizations
+				   ? ATTR_CONST_NOTHROW_LIST
+				   : ATTR_PURE_NOTHROW_LIST))
 
 DEF_UNUSED_BUILTIN(BUILT_IN_GETEXP)
 DEF_UNUSED_BUILTIN(BUILT_IN_GETMAN)
-- 
cgit v1.1

