This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lno-branch]: Patch to fix bootstrap problem on darwin






> I have bootstrapped the following patch on i686.  It's the same patch
> as Dan's, but it fixes also the other operations.
>
> Can you test it on powerpc?

Passed bootstrapped on powerpc-apple-darwin7.0.0.

thanks,
dorit



                                                                       
                      Pop Sébastian                                  
                      <pop@gauvain.u-st        To:       Dorit Naishlos/Haifa/IBM@IBMIL
                      rasbg.fr>                cc:       Daniel Berlin <dberlin@dberlin.org>, GCC Patches <gcc-patches@gcc.gnu.org>
                                               Subject:  Re: [lno-branch]: Patch to fix bootstrap problem on darwin
                      12/01/2004 17:20                                 
                                                                       




A better patch, since it has to modify only the behaviour of the
folder.


Index: tree-fold-const.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-fold-const.h,v
retrieving revision 1.1.2.2
diff -c -3 -p -r1.1.2.2 tree-fold-const.h
*** tree-fold-const.h          9 Jan 2004 12:15:53 -0000           1.1.2.2
--- tree-fold-const.h          12 Jan 2004 15:17:00 -0000
*************** static inline tree
*** 116,135 ****
  tree_fold_int_plus (tree a,
                             tree b)
  {
    if (TREE_CODE (a) == REAL_CST)
      return build (PLUS_EXPR, TREE_TYPE (a), a, b);
    if (TREE_CODE (b) == REAL_CST)
      return build (PLUS_EXPR, TREE_TYPE (b), a, b);
!   else if (TREE_TYPE (a) == TREE_TYPE (b))
!     return fold (build (PLUS_EXPR, TREE_TYPE (a), a, b));
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       return fold (build (PLUS_EXPR, integer_type_node, a, b));
      }
  }

  /* Fold the substraction.  */
--- 116,146 ----
  tree_fold_int_plus (tree a,
                             tree b)
  {
+   tree res;
+
    if (TREE_CODE (a) == REAL_CST)
      return build (PLUS_EXPR, TREE_TYPE (a), a, b);
+
    if (TREE_CODE (b) == REAL_CST)
      return build (PLUS_EXPR, TREE_TYPE (b), a, b);
!
!   if (TREE_TYPE (a) == TREE_TYPE (b))
!     res = fold (build (PLUS_EXPR, TREE_TYPE (a), a, b));
!
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       res = fold (build (PLUS_EXPR, integer_type_node, a, b));
      }
+
+   if (TREE_CODE (res) == NON_LVALUE_EXPR)
+     return TREE_OPERAND (res, 0);
+
+   else
+     return res;
  }

  /* Fold the substraction.  */
*************** static inline tree
*** 138,157 ****
  tree_fold_int_minus (tree a,
                              tree b)
  {
    if (TREE_CODE (a) == REAL_CST)
      return build (MINUS_EXPR, TREE_TYPE (a), a, b);
    if (TREE_CODE (b) == REAL_CST)
      return build (MINUS_EXPR, TREE_TYPE (b), a, b);
!   else if (TREE_TYPE (a) == TREE_TYPE (b))
!     return fold (build (MINUS_EXPR, TREE_TYPE (a), a, b));
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       return fold (build (MINUS_EXPR, integer_type_node, a, b));
      }
  }

  /* Fold the multiplication.  */
--- 149,179 ----
  tree_fold_int_minus (tree a,
                              tree b)
  {
+   tree res;
+
    if (TREE_CODE (a) == REAL_CST)
      return build (MINUS_EXPR, TREE_TYPE (a), a, b);
+
    if (TREE_CODE (b) == REAL_CST)
      return build (MINUS_EXPR, TREE_TYPE (b), a, b);
!
!   if (TREE_TYPE (a) == TREE_TYPE (b))
!     res = fold (build (MINUS_EXPR, TREE_TYPE (a), a, b));
!
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       res = fold (build (MINUS_EXPR, integer_type_node, a, b));
      }
+
+   if (TREE_CODE (res) == NON_LVALUE_EXPR)
+     return TREE_OPERAND (res, 0);
+
+   else
+     return res;
  }

  /* Fold the multiplication.  */
*************** static inline tree
*** 160,179 ****
  tree_fold_int_multiply (tree a,
                                     tree b)
  {
    if (TREE_CODE (a) == REAL_CST)
      return build (MULT_EXPR, TREE_TYPE (a), a, b);
    if (TREE_CODE (b) == REAL_CST)
      return build (MULT_EXPR, TREE_TYPE (b), a, b);
!   else if (TREE_TYPE (a) == TREE_TYPE (b))
!     return fold (build (MULT_EXPR, TREE_TYPE (a), a, b));
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       return fold (build (MULT_EXPR, integer_type_node, a, b));
      }
  }

  /* Division for integer result that rounds the quotient toward zero.  */
--- 182,212 ----
  tree_fold_int_multiply (tree a,
                                     tree b)
  {
+   tree res;
+
    if (TREE_CODE (a) == REAL_CST)
      return build (MULT_EXPR, TREE_TYPE (a), a, b);
+
    if (TREE_CODE (b) == REAL_CST)
      return build (MULT_EXPR, TREE_TYPE (b), a, b);
!
!   if (TREE_TYPE (a) == TREE_TYPE (b))
!     res = fold (build (MULT_EXPR, TREE_TYPE (a), a, b));
!
    else
      {
        a = copy_node (a);
        b = copy_node (b);
        TREE_TYPE (a) = integer_type_node;
        TREE_TYPE (b) = integer_type_node;
!       res = fold (build (MULT_EXPR, integer_type_node, a, b));
      }
+
+   if (TREE_CODE (res) == NON_LVALUE_EXPR)
+     return TREE_OPERAND (res, 0);
+
+   else
+     return res;
  }

  /* Division for integer result that rounds the quotient toward zero.  */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]