This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/45416] [4.5/4.6/4.7 Regression] Code size regression between 4.6/4.7(4.5) and 4.4 for ARM
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 Dec 2011 20:51:58 +0000
- Subject: [Bug middle-end/45416] [4.5/4.6/4.7 Regression] Code size regression between 4.6/4.7(4.5) and 4.4 for ARM
- Auto-submitted: auto-generated
- References: <bug-45416-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45416
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-05 20:51:58 UTC ---
I have a patch:
Index: expr.c
===================================================================
--- expr.c (revision 182017)
+++ expr.c (working copy)
@@ -10563,15 +10563,24 @@ do_store_flag (sepops ops, rtx target, e
so we just call into the folder and expand its result. */
if ((code == NE || code == EQ)
- && TREE_CODE (arg0) == BIT_AND_EXPR && integer_zerop (arg1)
- && integer_pow2p (TREE_OPERAND (arg0, 1))
+ && TREE_CODE (arg0) == SSA_NAME && integer_zerop (arg1)
&& (TYPE_PRECISION (ops->type) != 1 || TYPE_UNSIGNED (ops->type)))
{
- tree type = lang_hooks.types.type_for_mode (mode, unsignedp);
- return expand_expr (fold_single_bit_test (loc,
- code == NE ? NE_EXPR : EQ_EXPR,
- arg0, arg1, type),
- target, VOIDmode, EXPAND_NORMAL);
+ gimple srcstmt = get_gimple_for_ssa_name (arg0);
+ if (srcstmt
+ && TREE_CODE (gimple_assign_rhs_code (srcstmt)) == BIT_AND_EXPR
+ && integer_pow2p (gimple_assign_rhs2 (srcstmt))
+ {
+ enum tree_code tcode = code == NE ? NE_EXPR : EQ_EXPR;
+ tree type = lang_hooks.types.type_for_mode (mode, unsignedp);
+ tree temp = fold_build2 (loc, BIT_AND_EXPR, type,
+ gimple_assign_rhs1 (srcstmt),
+ gimple_assign_rhs2 (srcstmt));
+ return expand_expr (fold_single_bit_test (loc,
+ tcode,
+ arg0, arg1, type),
+ target, VOIDmode, EXPAND_NORMAL);
+ }
}
if (! get_subtarget (target)