+2015-06-26  Richard Biener  <rguenther@suse.de>
+
+       * match.pd: Allow associating FLOAT_TYPE_P when flag_associative_math.
+
+2015-06-26  Richard Biener  <rguenther@suse.de>
+
+       * match.pd: Allow (p +p off1) +p off2 to (p +p (off1 + off2))
+       irrespective on whether the inner operation has a single use
+       of both off are constant.
+
 2015-06-26  Uros Bizjak  <ubizjak@gmail.com>
            Segher Boessenkool  <segher@kernel.crashing.org>
 
 
 /* Associate (p +p off1) +p off2 as (p +p (off1 + off2)).  */
 (simplify
   (pointer_plus (pointer_plus@2 @0 @1) @3)
-  (if (single_use (@2))
+  (if (single_use (@2)
+       || (TREE_CODE (@1) == INTEGER_CST && TREE_CODE (@3) == INTEGER_CST))
    (pointer_plus @0 (plus @1 @3))))
 
 /* Pattern match
        && !TYPE_OVERFLOW_SANITIZED (type))
    (convert @1)))
 
- /* We can't reassociate floating-point or fixed-point plus or minus
-    because of saturation to +-Inf.  */
- (if (!FLOAT_TYPE_P (type) && !FIXED_POINT_TYPE_P (type))
+ /* We can't reassociate floating-point unless -fassociative-math
+    or fixed-point plus or minus because of saturation to +-Inf.  */
+ (if ((!FLOAT_TYPE_P (type) || flag_associative_math)
+      && !FIXED_POINT_TYPE_P (type))
 
   /* Match patterns that allow contracting a plus-minus pair
      irrespective of overflow issues.  */
 
 end
 
 ! { dg-final { scan-tree-dump "b = 5" "original" } }
-! { dg-final { scan-tree-dump "c_. = .a" "optimized" } }
-! { dg-final { scan-tree-dump "return c_.;" "optimized" } }
+! { dg-final { scan-tree-dump-times " = " 1 "optimized" } }