builtins.c (expand_builtin_mathfn, [...]): Avoid busy work when builtin is not suppor...
authorJan Hubicka <jh@suse.cz>
Sun, 29 Jun 2003 21:16:13 +0000 (23:16 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 29 Jun 2003 21:16:13 +0000 (21:16 +0000)
* builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2): Avoid
busy work when builtin is not supported by the backend.

From-SVN: r68681

gcc/ChangeLog
gcc/builtins.c

index 784d3b050783f5d92702e2ffa993c159fb7f75fa..621e59c393fc3eae0a5c312fc5e93bcfc22923d3 100644 (file)
@@ -1,3 +1,8 @@
+Sun Jun 29 23:06:32 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       * builtins.c (expand_builtin_mathfn, expand_builtin_mathfn_2): Avoid
+       busy work when builtin is not supported by the backend.
+
 2003-06-29  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
 
        * loop.c (count_one_set): Fix detection of registers set in more
index 26938105a551dce4d8cf32c52844eed118fbcfbc..e8ab4d5740d6c3a1ef50764e7b1c214047f6dfdf 100644 (file)
@@ -1789,6 +1789,10 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
 
   /* Make a suitable register to place result in.  */
   mode = TYPE_MODE (TREE_TYPE (exp));
+
+  /* Before working hard, check whether the instruction is available.  */
+  if (builtin_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing)
+    return 0;
   target = gen_reg_rtx (mode);
 
   if (! flag_errno_math || ! HONOR_NANS (mode))
@@ -1874,6 +1878,11 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
 
   /* Make a suitable register to place result in.  */
   mode = TYPE_MODE (TREE_TYPE (exp));
+
+  /* Before working hard, check whether the instruction is available.  */
+  if (builtin_optab->handlers[(int) mode].insn_code == CODE_FOR_nothing)
+    return 0;
+
   target = gen_reg_rtx (mode);
 
   if (! flag_errno_math || ! HONOR_NANS (mode))