From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23540 invoked by alias); 9 Apr 2010 07:38:35 -0000 Received: (qmail 23494 invoked by uid 48); 9 Apr 2010 07:38:25 -0000 Date: Fri, 09 Apr 2010 07:38:00 -0000 Message-ID: <20100409073825.23493.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/43698] Invalid code when building gentoo pax-utils-0.1.19 with -Os optimizations In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ramana at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-04/txt/msg00895.txt.bz2 ------- Comment #4 from ramana at gcc dot gnu dot org 2010-04-09 07:38 ------- It appears as though there's a latent bug in arm_ccfsm_state_machine. If you mark this correctly as being "predicable" which the rev insn is - the bug goes away. If arm_final_prescan_insn sees something of the following form, it goes ahead and assumes it can convert the rev in this pattern into a condexec and removes the branch. (jump_insn:TI 12 15 19 /tmp/bitswap.c:23 (set (pc) (if_then_else (eq (reg:CC 24 cc) (const_int 0 [0x0])) (label_ref:SI 23) (pc))) 228 {*arm_cond_branch} (expr_list:REG_DEAD (reg:CC 24 cc) (expr_list:REG_BR_PROB (const_int 3900 [0xf3c]) (nil))) -> 23) (note 19 12 21 [bb 3] NOTE_INSN_BASIC_BLOCK) (insn:TI 21 19 22 /tmp/bitswap.c:23 (set (reg:SI 2 r2 [orig:141 D.4313 ] [141]) (bswap:SI (reg:SI 2 r2 [152]))) 347 {arm_rev} (nil)) (insn:TI 22 21 23 /tmp/bitswap.c:23 (set (reg/v:DI 2 r2 [orig:133 __res ] [133]) (zero_extend:DI (reg:SI 2 r2 [orig:141 D.4313 ] [141]))) 138 {*arm_zero_extendsidi2} (expr_list:REG_UNUSED (reg:SI 3 r3) (nil))) The patch below which I'm testing, fixes the immediate problem with rev as below. Longer term we ought to remove the ccfsm_state_machine once we fix the problem with conditional calls. Index: arm.md =================================================================== --- arm.md (revision 158138) +++ arm.md (working copy) @@ -11201,8 +11201,9 @@ [(set (match_operand:SI 0 "s_register_operand" "=r") (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))] "TARGET_EITHER && arm_arch6" - "rev\t%0, %1" - [(set (attr "length") + "rev%?\t%0, %1" + [(set_attr "predicable" "yes") + (set (attr "length") (if_then_else (eq_attr "is_thumb" "yes") (const_int 2) (const_int 4)))] Ramana -- ramana at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |ramana at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2010-04-09 07:02:26 |2010-04-09 07:38:25 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43698