From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2600 invoked by alias); 9 May 2004 17:11:32 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2571 invoked by uid 48); 9 May 2004 17:11:31 -0000 Date: Sun, 09 May 2004 17:11:00 -0000 Message-ID: <20040509171131.2570.qmail@sourceware.org> From: "pb at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030526135310.10982.pb@gcc.gnu.org> References: <20030526135310.10982.pb@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/10982] [arm] poor optimisation of "if (var & const)" X-Bugzilla-Reason: CC X-SW-Source: 2004-05/txt/msg00792.txt.bz2 List-Id: ------- Additional Comments From pb at gcc dot gnu dot org 2004-05-09 17:11 ------- For that particular testcase, adding a pattern like the one below seems to allow combine to do the right thing. However, changing the "return 1" to "return 2" prevents this from matching. Something a bit more sophisticated might be needed. -- (define_insn_and_split "*zero_extract_compare0_shifted" [(set (match_operand:SI 0 "s_register_operand" "=r") (ne:SI (zero_extract:SI (match_operand:SI 1 "s_register_operand" "r") (match_operand:SI 2 "const_int_operand" "n") (const_int 0)) (const_int 0))) (clobber (reg:CC CC_REGNUM))] "TARGET_ARM" "#" "" [(parallel [(set (reg:CC_NOOV CC_REGNUM) (compare:CC_NOOV (ashift:SI (match_dup 1) (match_dup 2)) (const_int 0))) (set (match_dup 0) (ashift:SI (match_dup 1) (match_dup 2)))]) (set (match_dup 0) (if_then_else (eq:SI (reg:CC_NOOV CC_REGNUM) (const_int 0)) (match_dup 0) (const_int 1)))] "" ) ;; Match the second half of *zero_extract_compare0_shifted (define_insn "*movsi_conditional" [(set (match_operand:SI 0 "s_register_operand" "=r") (if_then_else (eq:SI (reg:CC_NOOV CC_REGNUM) (const_int 0)) (match_dup 0) (match_operand:SI 1 "const_int_operand" "n")))] "TARGET_ARM" "movne\\t%0, %1" [(set_attr "conds" "use")] ) -- What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |3.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10982