OSDN Git Service

PR 33870
[pf3gnuchains/gcc-fork.git] / gcc / dojump.c
index da162d6..b619e0f 100644 (file)
@@ -1,12 +1,13 @@
 /* Convert tree expression to rtl instructions, for GNU compiler.
    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -15,9 +16,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
 #include "system.h"
@@ -53,7 +53,8 @@ init_pending_stack_adjust (void)
 /* Discard any pending stack adjustment.  This avoid relying on the
    RTL optimizers to remove useless adjustments when we know the
    stack pointer value is dead.  */
-void discard_pending_stack_adjust (void)
+void
+discard_pending_stack_adjust (void)
 {
   stack_pointer_delta -= pending_stack_adjust;
   pending_stack_adjust = 0;
@@ -274,10 +275,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
           && (mode = mode_for_size (i + 1, MODE_INT, 0)) != BLKmode
           && (type = lang_hooks.types.type_for_mode (mode, 1)) != 0
           && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
-          && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
+          && (optab_handler (cmp_optab, TYPE_MODE (type))->insn_code
               != CODE_FOR_nothing))
         {
-          do_jump (convert (type, exp), if_false_label, if_true_label);
+          do_jump (fold_convert (type, exp), if_false_label, if_true_label);
           break;
         }
       goto normal;
@@ -333,10 +334,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
         if (! SLOW_BYTE_ACCESS
             && type != 0 && bitsize >= 0
             && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (exp))
-            && (cmp_optab->handlers[(int) TYPE_MODE (type)].insn_code
+            && (optab_handler (cmp_optab, TYPE_MODE (type))->insn_code
                != CODE_FOR_nothing))
           {
-            do_jump (convert (type, exp), if_false_label, if_true_label);
+            do_jump (fold_convert (type, exp), if_false_label, if_true_label);
             break;
           }
         goto normal;
@@ -550,37 +551,6 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
        }
       break;
 
-      /* Special case:
-          __builtin_expect (<test>, 0) and
-          __builtin_expect (<test>, 1)
-
-         We need to do this here, so that <test> is not converted to a SCC
-         operation on machines that use condition code registers and COMPARE
-         like the PowerPC, and then the jump is done based on whether the SCC
-         operation produced a 1 or 0.  */
-    case CALL_EXPR:
-      /* Check for a built-in function.  */
-      {
-       tree fndecl = get_callee_fndecl (exp);
-       tree arglist = TREE_OPERAND (exp, 1);
-
-       if (fndecl
-           && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
-           && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT
-           && arglist != NULL_TREE
-           && TREE_CHAIN (arglist) != NULL_TREE)
-         {
-           rtx seq = expand_builtin_expect_jump (exp, if_false_label,
-                                                 if_true_label);
-
-           if (seq != NULL_RTX)
-             {
-               emit_insn (seq);
-               return;
-             }
-         }
-      }
       /* Fall through and generate the normal code.  */
     default:
     normal:
@@ -916,11 +886,26 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp,
                                        if_true_label, if_false_label);
          break;
 
+       case GTU:
+         do_jump_by_parts_greater_rtx (mode, 1, op0, op1,
+                                       if_false_label, if_true_label);
+         break;
+
+       case GEU:
+         do_jump_by_parts_greater_rtx (mode, 1, op1, op0,
+                                       if_true_label, if_false_label);
+         break;
+
        case LT:
          do_jump_by_parts_greater_rtx (mode, 0, op1, op0,
                                        if_false_label, if_true_label);
          break;
 
+       case LE:
+         do_jump_by_parts_greater_rtx (mode, 0, op0, op1,
+                                       if_true_label, if_false_label);
+         break;
+
        case GT:
          do_jump_by_parts_greater_rtx (mode, 0, op0, op1,
                                        if_false_label, if_true_label);