------- Comment #8 from chrbr at gcc dot gnu dot org  2009-03-11 14:07 -------
I have picky disabled the canonicalization in fold_plusminus_mult_expr for 
identical constants that are power of 2, so my mov @(disp, rn) is back :-(. For
some reason your patch let the base+index computation factorization thru 

This is experimental for now, because expand_expr needs to be extended to
repair expressions like return ((a * 4) + 4) that are not an indirect_ref.
(thanks we differ PLUS expr from POINTER_PLUS_EXPR)

+++ fold-const.c        2009-03-11 13:49:40.000000000 +0100
@@ -7431,7 +7431,10 @@
   same = NULL_TREE;

   if (operand_equal_p (arg01, arg11, 0))
-    same = arg01, alt0 = arg00, alt1 = arg10;
+    {
+      if (code != PLUS_EXPR || exact_log2 (TREE_INT_CST_LOW (arg01)) == -1)
+       same = arg01, alt0 = arg00, alt1 = arg10;
+    }
   else if (operand_equal_p (arg00, arg10, 0))
     same = arg00, alt0 = arg01, alt1 = arg11;
   else if (operand_equal_p (arg00, arg11, 0))


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39423

Reply via email to