diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-20 13:33:51 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-02-20 13:33:51 +0000 |
commit | 73a954a137a4ad3aff3c816a4a401887669ab5f7 (patch) | |
tree | 95fa0014104dcb6887115c27e24a726801ecd2a0 /gcc/builtins.c | |
parent | 19636773804cc810ffb5dec03069184ff71404bc (diff) | |
download | gcc-73a954a137a4ad3aff3c816a4a401887669ab5f7.tar.gz |
* optabs.h (enum optab_index): Add new OTI_scalb.
(scalb_optab): Define corresponding macro.
* optabs.c (init_optabs): Initialize scalb_optab.
* genopinit.c (optabs): Implement scalb_optab using scalb?f3
patterns.
* builtins.c (expand_builtin_mathfn_2, expand_builtin): Handle
BUILT_IN_SCALB{,F,L}, BUILT_IN_SCALBN{,F,L} and BUILT_IN_SCALBLN{,F,L}.
(expand_builtin): Expand BUILT_IN_SCALB{,F,L}, BUILT_IN_SCALBN{,F,L}
and BUILT_IN_SCALBLN{,F,L} using expand_builtin_mathfn_2 if
flag_unsafe_math_optimizations is set.
* config/i386/i386.md (scalbxf3, scalb<mode>3): New expanders
to implement scalbf, scalb and scalbl built-ins as inline x87
intrinsics.
testsuite/ChangeLog
* gcc.dg/builtins-34.c: Add scalb/scalbn/scalbln cases.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122162 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 67d9bf63f25..e1c2deef647 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1973,10 +1973,15 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) bool errno_set = true; bool stable = true; - if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LDEXP - || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LDEXPF - || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_LDEXPL) - op1_type = INTEGER_TYPE; + switch (DECL_FUNCTION_CODE (fndecl)) + { + CASE_FLT_FN (BUILT_IN_SCALBN): + CASE_FLT_FN (BUILT_IN_SCALBLN): + CASE_FLT_FN (BUILT_IN_LDEXP): + op1_type = INTEGER_TYPE; + default: + break; + } if (!validate_arglist (exp, REAL_TYPE, op1_type, VOID_TYPE)) return NULL_RTX; @@ -1990,6 +1995,15 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget) builtin_optab = pow_optab; break; CASE_FLT_FN (BUILT_IN_ATAN2): builtin_optab = atan2_optab; break; + CASE_FLT_FN (BUILT_IN_SCALB): + if (REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (exp)))->b != 2) + return 0; + builtin_optab = scalb_optab; break; + CASE_FLT_FN (BUILT_IN_SCALBN): + CASE_FLT_FN (BUILT_IN_SCALBLN): + if (REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (exp)))->b != 2) + return 0; + /* Fall through... */ CASE_FLT_FN (BUILT_IN_LDEXP): builtin_optab = ldexp_optab; break; CASE_FLT_FN (BUILT_IN_FMOD): @@ -5963,6 +5977,9 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, CASE_FLT_FN (BUILT_IN_ATAN2): CASE_FLT_FN (BUILT_IN_LDEXP): + CASE_FLT_FN (BUILT_IN_SCALB): + CASE_FLT_FN (BUILT_IN_SCALBN): + CASE_FLT_FN (BUILT_IN_SCALBLN): if (! flag_unsafe_math_optimizations) break; |