Segher suggested that the change to favor (plus (ashift (...))) as a split point be conditionalized on the shift count being a constant -- seems quite reasonable to me.

Bootstrapped and regression tested on x86_64-linux-gnu as well as verified the 300+ test files generate the same code before/after on the PA and hppa.exp passes.

Installed on the trunk.

Jeff

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f02ba5c..bf90c86 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
 2015-05-26  Jeff Law  <l...@redhat.com>
 
+       * combine.c (find_split_point): Verify that the shift count is a
+       constant when choosing (plus (ashift ...)) as a split point.
+
        * tree-ssa-threadupdate.c: Replace 8 space sequences with tabs.
        No functional changes.
 
diff --git a/gcc/combine.c b/gcc/combine.c
index 73d141e..55a2e35 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5157,7 +5157,8 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
          worthless to try this split.  */
       if (!set_src
          && (GET_CODE (XEXP (x, 0)) == MULT
-             || GET_CODE (XEXP (x, 0)) == ASHIFT))
+             || (GET_CODE (XEXP (x, 0)) == ASHIFT
+                 && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)))
         return loc;
 
     default:

Reply via email to