[PATCH]: Fix PR rtl-optimization/27971

Raksit Ashok raksit@google.com
Wed Dec 5 21:26:00 GMT 2007


Please see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27971

Modified find_split_point in combine.c to catch an rtx of the form:

(mem/s:SI (plus:SI (and:SI (reg/v:SI 59 [ x ])
               (const_int 12 [0xc]))
           (symbol_ref:SI ("array") <var_decl 0xf7ef20b0 array>)) [3
array S4 A32])

and introduce a split at the first operand of the PLUS expr.

This enables us to combine/simplify/split the following three
instructions (x86 assembler output shown):

shrl    $2, %eax
andl    $3, %eax
movl    array(,%eax,4), %eax

into:

andl    $12, %eax
movl    array(%eax), %eax

Bootstrapped and tested on i686-pc-linux-gnu.

Ok for mainline?

-raksit


gcc/ChangeLog

2007-12-05  Raksit Ashok  <raksit@google.com>

	PR rtl-optimization/27971
	* combine.c (find_split_point): introduced a new split for certain
types of mem rtx.


Index: gcc/combine.c
===================================================================
--- gcc/combine.c       (revision 130592)
+++ gcc/combine.c       (working copy)
@@ -3967,6 +3967,15 @@ find_split_point (rtx *loc, rtx insn)
                         && OBJECT_P (SUBREG_REG (XEXP (XEXP (x, 0), 0)))))
            return &XEXP (XEXP (x, 0), 0);
        }
+
+      /* If we have a PLUS whose first operand is complex, try computing it
+         separately by making a split there.  */
+      if (GET_CODE (XEXP (x, 0)) == PLUS
+          && ! memory_address_p (GET_MODE (x), XEXP (x, 0))
+          && ! OBJECT_P (XEXP (XEXP (x, 0), 0))
+          && ! (GET_CODE (XEXP (XEXP (x, 0), 0)) == SUBREG
+                && OBJECT_P (SUBREG_REG (XEXP (XEXP (x, 0), 0)))))
+        return &XEXP (XEXP (x, 0), 0);
       break;

     case SET:



More information about the Gcc-patches mailing list