summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 16:34:20 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-08 16:34:20 +0000
commit246a017e682bd17beaaac461cbc52aab9213bed7 (patch)
treed6a2589788d2d96ce23e4a18e6a6325f473bfe53 /gcc/builtins.c
parentc53fae98625885c280385c8f16b558fcef2908a4 (diff)
downloadgcc-246a017e682bd17beaaac461cbc52aab9213bed7.tar.gz
PR 42694: add checks to make sure sqrt is supported
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167594 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 2816a7e1e61..eb2aa3e6b34 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3068,7 +3068,8 @@ expand_builtin_pow_root (location_t loc, tree arg0, tree arg1, tree type,
if (REAL_VALUES_EQUAL (c, dconsthalf))
op = build_call_nofold_loc (loc, sqrtfn, 1, arg0);
- else
+ /* Don't do this optimization if we don't have a sqrt insn. */
+ else if (optab_handler (sqrt_optab, mode) != CODE_FOR_nothing)
{
REAL_VALUE_TYPE dconst1_4 = dconst1;
REAL_VALUE_TYPE dconst3_4;
@@ -3114,7 +3115,8 @@ expand_builtin_pow_root (location_t loc, tree arg0, tree arg1, tree type,
op = build_call_nofold_loc (loc, cbrtfn, 1, arg0);
/* Now try 1/6. */
- else if (optimize_insn_for_speed_p ())
+ else if (optimize_insn_for_speed_p ()
+ && optab_handler (sqrt_optab, mode) != CODE_FOR_nothing)
{
REAL_VALUE_TYPE dconst1_6 = dconst1_3;
SET_REAL_EXP (&dconst1_6, REAL_EXP (&dconst1_6) - 1);