From patchwork Fri Nov 14 00:56:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 40793 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7A71E24493 for ; Fri, 14 Nov 2014 00:57:02 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf228790lam.2 for ; Thu, 13 Nov 2014 16:57:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:sender:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results; bh=uGVZWCmLP98qEnO7AYwi6wauqx9TMWhSW93eVS6I/Go=; b=KLphRRC4pLRtXPhOqPa+HtBaREJr9/H+FmkSZ7NnfqG4efGe+6m5WLQ9JW5Ext6Muh D2Wsp+olIzvZO9EZiQqASgtrG9JaNsktvkx1baIzUqd2A59DLI9q/9iPukyos/3krbZD I2R5V/sXcPHgrlUBGnNE8foRV/jwT0hN9+ihWxHUekxL+E1HULMshfqyUx9nhn0rZoC4 NXdEHAH1PeN9pW/n1dTrB4epLChwHmi9RUIZUIY6oG8jGQS8xt8YFGLIAWYp1X/mPFfw TCH48k2WKl2hagsrbp5waUgL1Db+UFOpaoWXsy7wa7dPuN2EZps19Bgj6Dklcz+/RADQ PGIQ== X-Gm-Message-State: ALoCoQlXx8xpna5vSGBgZVlBtUgRobeLI/3EFuhjFLA/SbvZK+W1oYTuFhYc2s6aKlvepjDAH+bt X-Received: by 10.112.29.52 with SMTP id g20mr4780824lbh.7.1415926621437; Thu, 13 Nov 2014 16:57:01 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.227 with SMTP id i3ls701747lae.28.gmail; Thu, 13 Nov 2014 16:57:01 -0800 (PST) X-Received: by 10.112.167.200 with SMTP id zq8mr5295116lbb.61.1415926621296; Thu, 13 Nov 2014 16:57:01 -0800 (PST) Received: from mail-la0-x233.google.com (mail-la0-x233.google.com. [2a00:1450:4010:c03::233]) by mx.google.com with ESMTPS id o3si40144840lag.29.2014.11.13.16.57.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Nov 2014 16:57:01 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) client-ip=2a00:1450:4010:c03::233; Received: by mail-la0-f51.google.com with SMTP id q1so14338950lam.10 for ; Thu, 13 Nov 2014 16:57:01 -0800 (PST) X-Received: by 10.112.137.39 with SMTP id qf7mr5268093lbb.47.1415926621198; Thu, 13 Nov 2014 16:57:01 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp692990lbc; Thu, 13 Nov 2014 16:57:00 -0800 (PST) X-Received: by 10.66.234.100 with SMTP id ud4mr6700892pac.36.1415926619641; Thu, 13 Nov 2014 16:56:59 -0800 (PST) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id gx9si13906177pbc.245.2014.11.13.16.56.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 16:56:59 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-384239-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 369 invoked by alias); 14 Nov 2014 00:56:22 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 32634 invoked by uid 89); 14 Nov 2014 00:56:21 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-ie0-f175.google.com Received: from mail-ie0-f175.google.com (HELO mail-ie0-f175.google.com) (209.85.223.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 14 Nov 2014 00:56:19 +0000 Received: by mail-ie0-f175.google.com with SMTP id at20so1581316iec.20 for ; Thu, 13 Nov 2014 16:56:17 -0800 (PST) X-Received: by 10.107.149.203 with SMTP id x194mr6571919iod.22.1415926577656; Thu, 13 Nov 2014 16:56:17 -0800 (PST) Received: from localhost.localdomain (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by mx.google.com with ESMTPSA id q17sm7339767ioe.21.2014.11.13.16.56.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Nov 2014 16:56:16 -0800 (PST) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id sAE0uFgC003129 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Thu, 13 Nov 2014 16:56:15 -0800 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id sAE0uFPx003128; Thu, 13 Nov 2014 16:56:15 -0800 From: Andrew Pinski To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [PATCH 3/3] [AARCH64] Add aligning of functions/loops/jumps Date: Thu, 13 Nov 2014 16:56:14 -0800 Message-Id: <1415926574-3080-4-git-send-email-apinski@cavium.com> In-Reply-To: <1415926574-3080-1-git-send-email-apinski@cavium.com> References: <1415926574-3080-1-git-send-email-apinski@cavium.com> X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::233 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On ThunderX, I found that aligning functions/loops/jumps to an 8 byte boundary have a slightly better performance because the hardware issue and dispatch matches what GCC's schedule has created. I set generic, cortex-a53 and cortex-a57 also to be 8 byte aligned also. Someone might want to change the cortext-a57 number to be more correct to that processor. Understanding how cortex-a53 is a dual issue, it made sense to set to 8 byte alignment but I don't know if it really make sense. Build and tested for aarch64-elf with no regressions. ChangeLog: * config/aarch64/aarch64-protos.h (tune_params): Add align field. * config/aarch64/aarch64.c (generic_tunings): Specify align. (cortexa53_tunings): Likewise. (cortexa57_tunings): Likewise. (thunderx_tunings): Likewise. (aarch64_override_options): Set align_loops, align_jumps, align_functions based on what the tuning struct. --- gcc/config/aarch64/aarch64-protos.h | 1 + gcc/config/aarch64/aarch64.c | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 9e0ff8c..3e70495 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -171,6 +171,7 @@ struct tune_params const int memmov_cost; const int issue_rate; const unsigned int fuseable_ops; + const unsigned int align; }; HOST_WIDE_INT aarch64_initial_elimination_offset (unsigned, unsigned); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5216ac0..9214332 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -317,7 +317,8 @@ static const struct tune_params generic_tunings = &generic_vector_cost, NAMED_PARAM (memmov_cost, 4), NAMED_PARAM (issue_rate, 2), - NAMED_PARAM (fuseable_ops, AARCH64_FUSE_NOTHING) + NAMED_PARAM (fuseable_ops, AARCH64_FUSE_NOTHING), + NAMED_PARAM (align, 8) }; static const struct tune_params cortexa53_tunings = @@ -328,7 +329,8 @@ static const struct tune_params cortexa53_tunings = &generic_vector_cost, NAMED_PARAM (memmov_cost, 4), NAMED_PARAM (issue_rate, 2), - NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK) + NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK), + NAMED_PARAM (align, 8) }; static const struct tune_params cortexa57_tunings = @@ -339,7 +341,8 @@ static const struct tune_params cortexa57_tunings = &cortexa57_vector_cost, NAMED_PARAM (memmov_cost, 4), NAMED_PARAM (issue_rate, 3), - NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK) + NAMED_PARAM (fuseable_ops, AARCH64_FUSE_MOV_MOVK), + NAMED_PARAM (align, 8) }; static const struct tune_params thunderx_tunings = @@ -350,7 +353,8 @@ static const struct tune_params thunderx_tunings = &generic_vector_cost, NAMED_PARAM (memmov_cost, 6), NAMED_PARAM (issue_rate, 2), - NAMED_PARAM (fuseable_ops, AARCH64_FUSE_CMP_BRANCH) + NAMED_PARAM (fuseable_ops, AARCH64_FUSE_CMP_BRANCH), + NAMED_PARAM (align, 8) }; /* A processor implementing AArch64. */ @@ -6501,6 +6505,18 @@ aarch64_override_options (void) #endif } + /* If not opzimizing for size, set the default + alignment to what the target wants */ + if (!optimize_size) + { + if (align_loops <= 0) + align_loops = aarch64_tune_params->align; + if (align_jumps <= 0) + align_jumps = aarch64_tune_params->align; + if (align_functions <= 0) + align_functions = aarch64_tune_params->align; + } + aarch64_override_options_after_change (); }