OSDN Git Service

PR 43305
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Mar 2010 12:37:28 +0000 (12:37 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 00:30:17 +0000 (09:30 +0900)
* builtins.c (expand_builtin_interclass_mathfn,
expand_builtin_signbit): Use maybe_emit_unop_insn, emit libcalls
if that fails.

testsuite/
* gcc.dg/pr43305.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157567 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog

index ce98eb4..d017666 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-19  Michael Matz  <matz@suse.de>
+
+       PR target/43305
+       * builtins.c (expand_builtin_interclass_mathfn,
+       expand_builtin_signbit): Use maybe_emit_unop_insn, emit libcalls
+       if that fails.
+
 2010-03-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43415
index 705a255..a68e743 100644 (file)
@@ -2312,6 +2312,8 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget)
 
   if (icode != CODE_FOR_nothing)
     {
+      rtx last = get_last_insn ();
+      tree orig_arg = arg;
       /* Make a suitable register to place result in.  */
       if (!target
          || GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
@@ -2332,8 +2334,10 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget)
 
       /* Compute into TARGET.
         Set TARGET to wherever the result comes back.  */
-      emit_unop_insn (icode, target, op0, UNKNOWN);
-      return target;
+      if (maybe_emit_unop_insn (icode, target, op0, UNKNOWN))
+       return target;
+      delete_insns_since (last);
+      CALL_EXPR_ARG (exp, 0) = orig_arg;
     }
 
   return NULL_RTX;
@@ -5197,9 +5201,11 @@ expand_builtin_signbit (tree exp, rtx target)
   icode = signbit_optab->handlers [(int) fmode].insn_code;
   if (icode != CODE_FOR_nothing)
     {
+      rtx last = get_last_insn ();
       target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
-      emit_unop_insn (icode, target, temp, UNKNOWN);
-      return target;
+      if (maybe_emit_unop_insn (icode, target, temp, UNKNOWN))
+       return target;
+      delete_insns_since (last);
     }
 
   /* For floating point formats without a sign bit, implement signbit
index 09f644d..3970547 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-19  Michael Matz  <matz@suse.de>
+
+       PR target/43305
+       * gcc.dg/pr43305.c: New testcase.
+
 2010-03-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43415