From patchwork Sat Feb 2 23:17:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Sawdey X-Patchwork-Id: 1035552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495192-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="N/dhWqIh"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43sVHz6nrgz9s3l for ; Sun, 3 Feb 2019 10:17:46 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=umZPX 1rnLHTtPjnprbnf3+KMOetyicwmPmTNNOkqAgDhc9/l8D+qjuNqCsgNdH2kt5wj2 kDhrpY1ev4lvkJElAUPZJesAxRsiI9gB47DduDuoNTg0/FAmRVVDYkBDY5yZnNZR hdEi5FEQyx4ol2D/YPN+JEXQFKwqod12pFp42M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=Z8DOoDYimd0 V3uDzW23mCZq4FBY=; b=N/dhWqIhX6YlH2IRbXR/qLNOwn7TGafYpYtpE9oTMoI SZ1BAewcw3XcIj21bX8ybhkJLRdYMjwScu0qSGioZlkteeuN/bNyDS0jxOraHNSg QcG7XkEhDgT6awYoUMxWAmNqDWwBFrg9VvuT8V7fRmxfbxcRGiWp9Jcp9xRyT4Yk = Received: (qmail 64096 invoked by alias); 2 Feb 2019 23:17:39 -0000 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 Received: (qmail 64087 invoked by uid 89); 2 Feb 2019 23:17:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=cold X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Feb 2019 23:17:37 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x12NEAPF101893 for ; Sat, 2 Feb 2019 18:17:35 -0500 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qd89bpypf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 02 Feb 2019 18:17:35 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 2 Feb 2019 23:17:35 -0000 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 2 Feb 2019 23:17:33 -0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x12NHWZw28966918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 2 Feb 2019 23:17:32 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C357C6057; Sat, 2 Feb 2019 23:17:32 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA7AAC6055; Sat, 2 Feb 2019 23:17:31 +0000 (GMT) Received: from ragesh4.local (unknown [9.211.125.192]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Sat, 2 Feb 2019 23:17:31 +0000 (GMT) To: gcc-patches List , Segher Boessenkool , Bill Schmidt , David Edelsohn From: Aaron Sawdey Subject: [PATCH, rs6000] PR target/89112 [8/9 Regression] fix bdnzt pattern for long branch case Date: Sat, 2 Feb 2019 17:17:31 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 x-cbid: 19020223-0016-0000-0000-0000097E2ED6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010524; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000277; SDB=6.01155494; UDB=6.00602629; IPR=6.00935938; MB=3.00025412; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-02 23:17:34 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19020223-0017-0000-0000-00004201BB77 Message-Id: <59261c98-2250-8cb7-7627-9c93a38a593c@linux.ibm.com> X-IsSubscribed: yes I needed to introduce a local label in this pattern because output_cbranch put out a second instruction in the long branch case. This fixes the issue but there are a couple ways this could be improved: * output_cbranch() is passed the original insn and assumes from that that the branch is a long branch. However this is incorrect because we are just branching to a local label we know is only a few instructions away. If there is a way to fix this, an unnecessary branch could be eliminated. * While the long branch case of this pattern needs to work, the real problem is that part of the code emitted by the memcmp expansion is being treated as cold code and moved to the end of the function. Ideally all of this code should stay together. I suspect I need to make some kind of branch frequency notation for this to happen. Regstrap passes on ppc64le power7/8/9, ok for trunk and backport to 8? Thanks! 2019-02-02 Aaron Sawdey * config/rs6000/rs6000.md (tf_): generate a local label for the long branch case. Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 268403) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -12639,8 +12639,8 @@ else { static char seq[96]; - char *bcs = output_cbranch (operands[3], "$+8", 1, insn); - sprintf(seq, " $+12\;%s;b %%l0", bcs); + char *bcs = output_cbranch (operands[3], ".L%=", 1, insn); + sprintf(seq, " .L%%=\;%s\;b %%l0\;.L%%=:", bcs); return seq; } }