From patchwork Thu Nov 11 23:52:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 70894 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 01392B712C for ; Fri, 12 Nov 2010 10:52:32 +1100 (EST) Received: (qmail 5282 invoked by alias); 11 Nov 2010 23:52:30 -0000 Received: (qmail 5274 invoked by uid 22791); 11 Nov 2010 23:52:29 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Nov 2010 23:52:24 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oABNqN3A005587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Nov 2010 18:52:23 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oABNqM6R004317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Nov 2010 18:52:22 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oABNqMPN006620; Fri, 12 Nov 2010 00:52:22 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oABNqLNm006619; Fri, 12 Nov 2010 00:52:21 +0100 Date: Fri, 12 Nov 2010 00:52:21 +0100 From: Jakub Jelinek To: Richard Henderson Cc: Uros Bizjak , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix i386 *_cconly shifts (PR target/46088) Message-ID: <20101111235221.GN29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20101111153536.GG29412@tyan-ft48-01.lab.bos.redhat.com> <4CDC110E.3040501@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4CDC110E.3040501@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Thu, Nov 11, 2010 at 07:51:42AM -0800, Richard Henderson wrote: > On 11/11/2010 07:35 AM, Jakub Jelinek wrote: > > - && ix86_binary_operator_ok (ASHIFT, mode, operands)" > > + /* Can't use ix86_binary_operator_ok here, as the scratch > > + operand might be missing. */ > > + && !MEM_P (operands[1])" > > Better to change the predicate on op1 to register_operand, > and drop the test here inside the extra predicate. > > Ok with that change. Thanks, this is what I've committed after bootstrap/regtest on x86_64-linux and i686-linux: 2010-11-12 Jakub Jelinek PR target/46088 * config/i386/i386.md (*ashl3_cconly, *3_cconly): Don't use ix86_binary_operator_ok, change nonimmediate_operand predicate to register_operand. * gcc.dg/pr46088.c: New test. Jakub --- gcc/config/i386/i386.md.jj 2010-11-11 09:38:56.000000000 +0100 +++ gcc/config/i386/i386.md 2010-11-11 12:04:40.000000000 +0100 @@ -9714,7 +9714,7 @@ (define_insn "*ashlsi3_cmp_zext" (define_insn "*ashl3_cconly" [(set (reg FLAGS_REG) (compare - (ashift:SWI (match_operand:SWI 1 "nonimmediate_operand" "0") + (ashift:SWI (match_operand:SWI 1 "register_operand" "0") (match_operand:QI 2 "" "")) (const_int 0))) (clobber (match_scratch:SWI 0 "="))] @@ -9723,8 +9723,7 @@ (define_insn "*ashl3_cconly" || (operands[2] == const1_rtx && (TARGET_SHIFT1 || TARGET_DOUBLE_WITH_ADD))) - && ix86_match_ccmode (insn, CCGOCmode) - && ix86_binary_operator_ok (ASHIFT, mode, operands)" + && ix86_match_ccmode (insn, CCGOCmode)" { switch (get_attr_type (insn)) { @@ -10081,7 +10080,7 @@ (define_insn "*3_cco [(set (reg FLAGS_REG) (compare (any_shiftrt:SWI - (match_operand:SWI 1 "nonimmediate_operand" "0") + (match_operand:SWI 1 "register_operand" "0") (match_operand:QI 2 "" "")) (const_int 0))) (clobber (match_scratch:SWI 0 "="))] @@ -10089,8 +10088,7 @@ (define_insn "*3_cco || !TARGET_PARTIAL_FLAG_REG_STALL || (operands[2] == const1_rtx && TARGET_SHIFT1)) - && ix86_match_ccmode (insn, CCGOCmode) - && ix86_binary_operator_ok (, mode, operands)" + && ix86_match_ccmode (insn, CCGOCmode)" { if (operands[2] == const1_rtx && (TARGET_SHIFT1 || optimize_function_for_size_p (cfun))) --- gcc/testsuite/gcc.dg/pr46088.c.jj 2010-11-11 12:09:08.000000000 +0100 +++ gcc/testsuite/gcc.dg/pr46088.c 2010-11-11 12:08:49.000000000 +0100 @@ -0,0 +1,12 @@ +/* PR target/46088 */ +/* { dg-do compile } */ +/* { dg-options "-Os -fnon-call-exceptions -fpeel-loops" } */ + +extern void bar (void); + +void +foo (int i) +{ + if (i >> 3) + bar (); +}