From patchwork Wed Aug 8 18:32:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 175949 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 207112C007E for ; Thu, 9 Aug 2012 04:33:12 +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=1345055593; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=6BZNZux FlwZ474UUrup6F8Cw/hU=; b=M9180onhKF91Cv+R8glNw+rUsUYpciwxXMlUKC3 jPGWjxh9wAFPrPUIzik4Z1Kf6qhLhrXJoYpeE/YmH940RLayAupE8ESb9QuqPcHi tPegHBoOw4yZPLH1O5g0yuj7c7ESQLkGgQLuzxDJAnGdADHWeUmlF4w+YDilqFdc KYZU= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=NrecjYiHNxC2aT5xa8yM0cijONiFPuvXRtm3dLP8jWCuSD1thypShqz2MbbTY8 j+Q+0esdMQdhrsWAFx4wTRfS7G1GSTNB/GjzSB9mmi9px37uujzF67W+B4Jg+wYT h2IAGebJ1heEdAnJpRIHr64mv4RvR54b3jIKPu6XMnnL8=; Received: (qmail 28999 invoked by alias); 8 Aug 2012 18:33:10 -0000 Received: (qmail 28987 invoked by uid 22791); 8 Aug 2012 18:33:09 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, 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; Wed, 08 Aug 2012 18:32:51 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q78IWnv0014533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 8 Aug 2012 14:32:49 -0400 Received: from anchor.twiddle.home (vpn-10-225.rdu.redhat.com [10.11.10.225]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q78IWmqj002253; Wed, 8 Aug 2012 14:32:49 -0400 Message-ID: <5022B0D0.6080802@redhat.com> Date: Wed, 08 Aug 2012 11:32:48 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Ulrich Weigand , GCC Patches Subject: s390: rearrange temp moves in s390_expand_cs_hqi 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 In the same vein as your CAS boolean output patch, if we rearrange the copies here we can get the combined compare-and-branch insn for the z10. I see that the z196 prefers not to use those, but the number of insns in that case remains the same, merely in a different order. Can you please test with --with-arch=z10? r~ * config/s390/s390.c (s390_expand_cs_hqi): Copy val to a temp before performing the compare for the restart loop. commit 7c855c60ce06b2d9ad0774877ffab38a8cc48f2d Author: Richard Henderson Date: Mon Aug 6 15:08:18 2012 -0700 s390: Rearrange temporary moves for use of CRJ diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 20a2db6..6b75dad 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -4821,7 +4821,7 @@ s390_expand_cs_hqi (enum machine_mode mode, rtx btarget, rtx vtarget, rtx mem, rtx cmp, rtx new_rtx, bool is_weak) { struct alignment_context ac; - rtx cmpv, newv, val, resv, cc, seq0, seq1, seq2, seq3; + rtx cmpv, newv, val, cc, seq0, seq1, seq2, seq3; rtx res = gen_reg_rtx (SImode); rtx csloop = NULL, csend = NULL; @@ -4869,14 +4869,18 @@ s390_expand_cs_hqi (enum machine_mode mode, rtx btarget, rtx vtarget, rtx mem, emit_insn (gen_cstorecc4 (btarget, cc, XEXP (cc, 0), XEXP (cc, 1))); else { + rtx tmp; + /* Jump to end if we're done (likely?). */ s390_emit_jump (csend, cc); - /* Check for changes outside mode, and loop internal if so. */ - resv = expand_simple_binop (SImode, AND, res, ac.modemaski, - NULL_RTX, 1, OPTAB_DIRECT); - cc = s390_emit_compare (NE, resv, val); - emit_move_insn (val, resv); + /* Check for changes outside mode, and loop internal if so. + Arrange the moves so that the compare is adjacent to the + branch so that we can generate CRJ. */ + tmp = copy_to_reg (val); + force_expand_binop (SImode, and_optab, res, ac.modemaski, val, + 1, OPTAB_DIRECT); + cc = s390_emit_compare (NE, val, tmp); s390_emit_jump (csloop, cc); /* Failed. */