This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Another Blackfin gas constant folding patch


This one turns sym - const into sym + (-const); necessary because we deleted the stack reloc code that handled the former.


Bernd


Index: gas/ChangeLog.bfin
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.17/gas/ChangeLog.bfin,v
retrieving revision 1.7
diff -c -p -r1.7 ChangeLog.bfin
*** gas/ChangeLog.bfin	7 Sep 2006 15:41:20 -0000	1.7
--- gas/ChangeLog.bfin	18 Sep 2006 19:36:35 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2006-09-18  Bernd Schmidt  <bernd.schmidt@analog.com>
+ 
+ 	* config/bfin-parse.y (binary): Change sub of const to add of negated
+ 	const.
+ 
  2006-09-07  Bernd Schmidt  <bernd.schmidt@analog.com>
  
  	* config/bfin-parse.y (binary): Do some more constant folding for
Index: gas/config/bfin-parse.y
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.17/gas/config/bfin-parse.y,v
retrieving revision 1.6
diff -c -p -r1.6 bfin-parse.y
*** gas/config/bfin-parse.y	7 Sep 2006 15:41:21 -0000	1.6
--- gas/config/bfin-parse.y	18 Sep 2006 19:36:36 -0000
*************** binary (Expr_Op_Type op, Expr_Node *x, E
*** 4365,4370 ****
--- 4365,4376 ----
        x = y;
        y = t;
      }
+   /* Canonicalize subtraction of const to addition of negated const.  */
+   if (op == Expr_Op_Type_Sub && y->type == Expr_Node_Constant)
+     {
+       op = Expr_Op_Type_Add;
+       y->value.i_value = -y->value.i_value;
+     }
    if (y->type == Expr_Node_Constant && x->type == Expr_Node_Binop
        && x->Right_Child->type == Expr_Node_Constant)
      {

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