diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2013-05-28 07:26:35 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-05-28 07:26:35 +0000 |
commit | 5c3eacbbdb118b63ee65b1774a9d1b003afed908 (patch) | |
tree | 0690ee378a242808ef4348577f657b3c0e03b1f3 /gcc/builtins.c | |
parent | eb9b2285911d52a5db151c816b93883b79119a6f (diff) | |
download | gcc-5c3eacbbdb118b63ee65b1774a9d1b003afed908.zip gcc-5c3eacbbdb118b63ee65b1774a9d1b003afed908.tar.gz gcc-5c3eacbbdb118b63ee65b1774a9d1b003afed908.tar.bz2 |
invoke.texi (SPARC Options): Document -mfix-ut699.
* doc/invoke.texi (SPARC Options): Document -mfix-ut699.
* builtins.c (expand_builtin_mathfn) <BUILT_IN_SQRT>: Try to widen the
mode if the instruction isn't available in the original mode.
* config/sparc/sparc.opt (mfix-ut699): New option.
* config/sparc/sparc.md (muldf3_extend): Disable if -mfix-ut699.
(divdf3): Turn into expander.
(divdf3_nofix): New insn.
(divdf3_fix): Likewise.
(divsf3): Disable if -mfix-ut699.
(sqrtdf2): Turn into expander.
(sqrtdf2_nofix): New insn.
(sqrtdf2_fix): Likewise.
(sqrtsf2): Disable if -mfix-ut699.
From-SVN: r199366
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 1fbd2f3..402bb1f 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1961,6 +1961,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) tree fndecl = get_callee_fndecl (exp); enum machine_mode mode; bool errno_set = false; + bool try_widening = false; tree arg; if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE)) @@ -1972,6 +1973,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) { CASE_FLT_FN (BUILT_IN_SQRT): errno_set = ! tree_expr_nonnegative_p (arg); + try_widening = true; builtin_optab = sqrt_optab; break; CASE_FLT_FN (BUILT_IN_EXP): @@ -2028,8 +2030,10 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget) if (! flag_errno_math || ! HONOR_NANS (mode)) errno_set = false; - /* Before working hard, check whether the instruction is available. */ - if (optab_handler (builtin_optab, mode) != CODE_FOR_nothing + /* Before working hard, check whether the instruction is available, but try + to widen the mode for specific operations. */ + if ((optab_handler (builtin_optab, mode) != CODE_FOR_nothing + || (try_widening && !excess_precision_type (TREE_TYPE (exp)))) && (!errno_set || !optimize_insn_for_size_p ())) { rtx result = gen_reg_rtx (mode); |