From patchwork Tue Jun 12 21:22:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 164500 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 0F3F7B6FA8 for ; Wed, 13 Jun 2012 07:22:55 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1340140976; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=vtcXHyWlxjbp9i2iQ7Dd 6fTk6HQ=; b=GxaPe3cA2A2rMJSpMYjpXeyLMuNxmtG1d0uw5d9OFh2MEFi0m8/d gxRtT0CFAZaA/N65tZA3prqJEjXQVspEHjClvFuhxueOmjgIIj4dGR03ed0Qjfh1 O5+FLTWKi5FzUF6w8urQLRfgpuKR1M1PGdUQzrSIwzxjo1rP+1cwjFg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FG1yZA50ZGnnMJXsGyEe1UO2aBqFoWLZt7OLvQZOdgx6uEGL7a0bgMzTtIA2+D p26Zmd/2KfhD0fYrH4mwOLgZ0v4qqWHg2taW8mbZKm1TOHClXQmqtJgF23QhAR/B 6GrlE0xyUdGm9pT+K/CX3OW0swfa4O274V00JVYMshC8Y=; Received: (qmail 23055 invoked by alias); 12 Jun 2012 21:22:51 -0000 Received: (qmail 23041 invoked by uid 22791); 12 Jun 2012 21:22:49 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS 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; Tue, 12 Jun 2012 21:22:33 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5CLMWYv027758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Jun 2012 17:22:33 -0400 Received: from zalov.cz (vpn1-5-217.ams2.redhat.com [10.36.5.217]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5CLMU6U023754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jun 2012 17:22:32 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id q5CLMTWK031034; Tue, 12 Jun 2012 23:22:29 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q5CLMSiq031033; Tue, 12 Jun 2012 23:22:28 +0200 Date: Tue, 12 Jun 2012 23:22:28 +0200 From: Jakub Jelinek To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Add anddi_1 -> andsi_1_zext splitter (PR target/53639) Message-ID: <20120612212228.GT24904@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline 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 Hi! The combiner combines (set (reg:SI x) (and:SI (reg:SI y) (const_int 1234))) (set (reg:DI z) (zero_extend:DI (reg:SI x))) into (set (reg:DI z) (and:DI (subreg:DI (reg:SI (y) 0) (const_int 1234)))) which unfortunately isn't the best form on x86_64 from RA POV, because if y needs to be moved around, with the paradoxical subreg it is copied around as DImode which is one byte longer than SImode copy. We only need the low 32-bits from that though. The following patch fixes it, by splitting what combiner creates before RA into andsi_1_zext pattern. My initial version of the patch did it for all DImode operands[1], but that unfortunately regressed pr49095.c where mem &= const with flag setting is no longer being peepholed. So, this patch limits it to whatever combiner creates. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-06-12 Jakub Jelinek PR target/53639 * config/i386/i386.md (*anddi_1 into *andsi_1_zext splitter): New. Jakub --- gcc/config/i386/i386.md.jj 2012-06-12 09:46:26.449838954 +0200 +++ gcc/config/i386/i386.md 2012-06-12 12:22:58.972769925 +0200 @@ -7933,6 +7933,18 @@ (define_insn "*andqi_1_slp" [(set_attr "type" "alu1") (set_attr "mode" "QI")]) +;; Turn *anddi_1 into *andsi_1_zext if possible. +(define_split + [(set (match_operand:DI 0 "register_operand") + (and:DI (subreg:DI (match_operand:SI 1 "register_operand") 0) + (match_operand:DI 2 "x86_64_zext_immediate_operand"))) + (clobber (reg:CC FLAGS_REG))] + "TARGET_64BIT" + [(parallel [(set (match_dup 0) + (zero_extend:DI (and:SI (match_dup 1) (match_dup 2)))) + (clobber (reg:CC FLAGS_REG))])] + "operands[2] = gen_lowpart (SImode, operands[2]);") + (define_split [(set (match_operand:SWI248 0 "register_operand") (and:SWI248 (match_operand:SWI248 1 "nonimmediate_operand")