From patchwork Tue Jan 13 04:48:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 428258 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414B01401AC for ; Tue, 13 Jan 2015 15:48:58 +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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=bRCYj94amJVyAomO79h4YxwCMyxuhInrzeq/HMTCdz4xX3 bQLkwl0Oz5cp/QkV+y5I2d1noNRXF0nuFtuA3Xuxce6ktBx1/Ct9IULX3ndQxYt+ mkcJ30Nl61hT5Xhl34qFht0kDlGvmOsEfY+KVGDJfTjMs3/jw/NqB28A6Qozg= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=v4qdJ2fK+VAN1Zju7OoofSHpZrU=; b=ZWp4UGSoK+wtxfD5qc3l NsjNBNk/JQ1FiA+ZvGCqNuq+wVFyN/SRGRh1QN6XbDILYNNtvauqzQO2DV2BwZca TJsbNizX/q5k+4qvPUAl1dXoIES/bOIGf+EIdOOPqpx7JNDxXYgdbJqAX4qHaH3a jPvdn8EP9qUQLiAZoJH19+4= Received: (qmail 9326 invoked by alias); 13 Jan 2015 04:48:47 -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 9290 invoked by uid 89); 13 Jan 2015 04:48:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f180.google.com Received: from mail-lb0-f180.google.com (HELO mail-lb0-f180.google.com) (209.85.217.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 13 Jan 2015 04:48:38 +0000 Received: by mail-lb0-f180.google.com with SMTP id l4so682328lbv.11 for ; Mon, 12 Jan 2015 20:48:33 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.112.84.225 with SMTP id c1mr40014645lbz.22.1421124513321; Mon, 12 Jan 2015 20:48:33 -0800 (PST) Received: by 10.25.21.9 with HTTP; Mon, 12 Jan 2015 20:48:33 -0800 (PST) Date: Mon, 12 Jan 2015 20:48:33 -0800 Message-ID: Subject: [PATCH/AARCH64] Correctly handle stores of zero in fusion_load_store From: Andrew Pinski To: GCC Patches X-IsSubscribed: yes Hi, With stores, we can get (const_int 0) as the src which has a mode of VOIDmode but this can be a valid store for optimizing into a store pair. This patch changes checking for the src mode to checking dest mode instead which does not have this issue. I added a testcase which shows the issue where store pair was not being created before but is after. OK? Build and tested for aarch64-elf with no regressions. Thanks, Andrew Pinski ChangeLog: * config/aarch64/aarch64.c (fusion_load_store): Check dest mode instead of src mode. * gcc.target/aarch64/store-pair-1.c: New testcase. Index: testsuite/gcc.target/aarch64/store-pair-1.c =================================================================== --- testsuite/gcc.target/aarch64/store-pair-1.c (revision 0) +++ testsuite/gcc.target/aarch64/store-pair-1.c (revision 0) @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int f(int *a, int b) +{ + a[28] = 0; + a[29] = b; + a[31] = 0; +} + +/* We should be able to produce store pair for the store of 28/29 store. */ +{ dg-final { scan-assembler "stp\tw\[0-9\]+, w\[0-9\]+" } } Index: config/aarch64/aarch64.c =================================================================== --- config/aarch64/aarch64.c (revision 219508) +++ config/aarch64/aarch64.c (working copy) @@ -10520,8 +10520,8 @@ fusion_load_store (rtx_insn *insn, rtx * src = SET_SRC (x); dest = SET_DEST (x); - if (GET_MODE (src) != SImode && GET_MODE (src) != DImode - && GET_MODE (src) != SFmode && GET_MODE (src) != DFmode) + if (GET_MODE (dest) != SImode && GET_MODE (dest) != DImode + && GET_MODE (dest) != SFmode && GET_MODE (dest) != DFmode) return SCHED_FUSION_NONE; if (GET_CODE (src) == SIGN_EXTEND)