From patchwork Wed Sep 29 01:36:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Stump X-Patchwork-Id: 66034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 76A14B7110 for ; Wed, 29 Sep 2010 11:36:18 +1000 (EST) Received: (qmail 32566 invoked by alias); 29 Sep 2010 01:36:16 -0000 Received: (qmail 32555 invoked by uid 22791); 29 Sep 2010 01:36:15 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta08.emeryville.ca.mail.comcast.net (HELO qmta08.emeryville.ca.mail.comcast.net) (76.96.30.80) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Sep 2010 01:36:09 +0000 Received: from omta17.emeryville.ca.mail.comcast.net ([76.96.30.73]) by qmta08.emeryville.ca.mail.comcast.net with comcast id CQvw1f0021afHeLA8Rc8PH; Wed, 29 Sep 2010 01:36:08 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta17.emeryville.ca.mail.comcast.net with comcast id CRc71f0060BKwT48dRc72q; Wed, 29 Sep 2010 01:36:08 +0000 From: Mike Stump Subject: canonical condition branch Date: Tue, 28 Sep 2010 18:36:06 -0700 Message-Id: <93FB9EB0-77DA-4DF2-B25F-2CE73CE30D8E@comcast.net> To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1081) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I have a port with a pattern like: (define_insn "*branch_if_bit_set" [(set (pc) (if_then_else (zero_extract:DI (match_operand:DI 0 "register_operand" "r") (const_int 1) (match_operand 1 "immediate" "")) (label_ref (match_operand 2 "" "")) (pc)))] "" "branch_if_bit_set\t%0,%1,%2") I used that pattern as that is what I saw combine looking for and failing to find... but, in rtlanal.c (canonicalize_condition), we have: which drops op2 because zero_extract is a 3 operand code, not a 2 operand code. So, then question is, should we add the above patch to avoid building bad rtl code? Index: gcc/gcc/rtlanal.c =================================================================== --- gcc/gcc/rtlanal.c (revision 850) +++ gcc/gcc/rtlanal.c (working copy) @@ -4933,6 +4933,9 @@ if (CC0_P (op0)) return 0; + if (GET_RTX_LENGTH (code) != 2) + return 0; + return gen_rtx_fmt_ee (code, VOIDmode, op0, op1); }