From patchwork Tue Oct 21 21:37:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 401840 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 80593140076 for ; Wed, 22 Oct 2014 08:38:04 +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=Bml+riUs34qPs1yw1JHxGB87VBaP2x4Y++PL+zxmXhl0Ii R64J7W0q0ihWPT6joSMFuO6Up5TjQPAe5K0jm5UyvjILzicHXByQpgQvN9dvdXVV sHm0uS1aZjKRXcVMz981+MgSCn/7nukGb0X/oIW1pPCBHzYNi9ZEoPPCOAedk= 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=wYGJ15rRq7hNFrFXchxUyGMbIPk=; b=nla+DNZMZvs4dJD3wODf x2DNCe6jGnAzd2fo6sc1I5a51+PsqMkcuyRurkUuqYjVVm/ziLe9zTI0WGAYP81C yhKyENInVM+6KieezIxE0zujH1uAMNYiyg4VD8cIVmN89Ow9rmDcB3Dcb0mrGyPx 2x4YHR6hik9SaAKkbX7VtxI= Received: (qmail 5266 invoked by alias); 21 Oct 2014 21:37:57 -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 5252 invoked by uid 89); 21 Oct 2014 21:37:56 -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, 21 Oct 2014 21:37:55 +0000 Received: by mail-lb0-f180.google.com with SMTP id n15so1766015lbi.39 for ; Tue, 21 Oct 2014 14:37:51 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.132.104 with SMTP id ot8mr37421392lbb.3.1413927471150; Tue, 21 Oct 2014 14:37:51 -0700 (PDT) Received: by 10.25.213.80 with HTTP; Tue, 21 Oct 2014 14:37:50 -0700 (PDT) Date: Tue, 21 Oct 2014 14:37:50 -0700 Message-ID: Subject: [PATCH/AARCH64] Move the rest of the cost tables to aarch64-cost-tables.h From: Andrew Pinski To: GCC Patches X-IsSubscribed: yes Hi, To make aarch64.c a little smaller and a little easier to understand, I have moved the rest of the cost tables (cpu_addrcost_table, cpu_regmove_cost, cpu_vector_cost) to aarch64-cost-tables. I also fixed up the inconstancy in the use of __extension__ on some of the structures and not all of them. I used a define to allow it easier instead of having to have "#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007" each time. OK? Build and tested on aarch64-elf with no regressions. Thanks, Andrew Pinski ChangeLog: * config/aarch64/aarch64-cost-tables.h (NAMED_PARAM): New define. (NEED_EXTENSION): New define. (generic_addrcost_table): Moved from aarch64.c. (cortexa57_addrcost_table): Likewise. (generic_regmove_cost): Likewise. (cortexa57_regmove_cost): Likewise. (cortexa53_regmove_cost): Likewise. (thunderx_regmove_cost): Likewise. (generic_vector_cost): Likewise. (cortexa57_vector_cost): Likewise. * config/aarch64/aarch64.c (NAMED_PARAM): Delete, moved to aarch64-cost-tables.h. (generic_addrcost_table): Likewise. (cortexa57_addrcost_table): Likewise. (generic_regmove_cost): Likewise. (cortexa57_regmove_cost): Likewise. (cortexa53_regmove_cost): Likewise. (thunderx_regmove_cost): Likewise. (generic_vector_cost): Likewise. (cortexa57_vector_cost): Likewise. (generic_tunings): Use NEED_EXTENSION. (cortexa53_tunings): Likewise. (cortexa57_tunings): Likewise. (thunderx_tunings): Likewise. Index: config/aarch64/aarch64-cost-tables.h =================================================================== --- config/aarch64/aarch64-cost-tables.h (revision 216524) +++ config/aarch64/aarch64-cost-tables.h (working copy) @@ -125,7 +125,135 @@ const struct cpu_cost_table thunderx_ext } }; +#if HAVE_DESIGNATED_INITIALIZERS +#define NAMED_PARAM(NAME, VAL) .NAME = (VAL) +#else +#define NAMED_PARAM(NAME, VAL) (VAL) +#endif + +#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 +#define NEED_EXTENSION __extension__ +#else +#define NEED_EXTENSION +#endif + + +/* The address cost models. */ +NEED_EXTENSION +static const struct cpu_addrcost_table generic_addrcost_table = +{ +#if HAVE_DESIGNATED_INITIALIZERS + .addr_scale_costs = +#endif + { + NAMED_PARAM (hi, 0), + NAMED_PARAM (si, 0), + NAMED_PARAM (di, 0), + NAMED_PARAM (ti, 0), + }, + NAMED_PARAM (pre_modify, 0), + NAMED_PARAM (post_modify, 0), + NAMED_PARAM (register_offset, 0), + NAMED_PARAM (register_extend, 0), + NAMED_PARAM (imm_offset, 0) +}; + +NEED_EXTENSION +static const struct cpu_addrcost_table cortexa57_addrcost_table = +{ +#if HAVE_DESIGNATED_INITIALIZERS + .addr_scale_costs = +#endif + { + NAMED_PARAM (hi, 1), + NAMED_PARAM (si, 0), + NAMED_PARAM (di, 0), + NAMED_PARAM (ti, 1), + }, + NAMED_PARAM (pre_modify, 0), + NAMED_PARAM (post_modify, 0), + NAMED_PARAM (register_offset, 0), + NAMED_PARAM (register_extend, 0), + NAMED_PARAM (imm_offset, 0), +}; + + +/* Register to Register move costs */ +NEED_EXTENSION +static const struct cpu_regmove_cost generic_regmove_cost = +{ + NAMED_PARAM (GP2GP, 1), + NAMED_PARAM (GP2FP, 2), + NAMED_PARAM (FP2GP, 2), + NAMED_PARAM (FP2FP, 2) +}; + +NEED_EXTENSION +static const struct cpu_regmove_cost cortexa57_regmove_cost = +{ + NAMED_PARAM (GP2GP, 1), + /* Avoid the use of slow int<->fp moves for spilling by setting + their cost higher than memmov_cost. */ + NAMED_PARAM (GP2FP, 5), + NAMED_PARAM (FP2GP, 5), + NAMED_PARAM (FP2FP, 2) +}; + +NEED_EXTENSION +static const struct cpu_regmove_cost cortexa53_regmove_cost = +{ + NAMED_PARAM (GP2GP, 1), + /* Avoid the use of slow int<->fp moves for spilling by setting + their cost higher than memmov_cost. */ + NAMED_PARAM (GP2FP, 5), + NAMED_PARAM (FP2GP, 5), + NAMED_PARAM (FP2FP, 2) +}; + +NEED_EXTENSION +static const struct cpu_regmove_cost thunderx_regmove_cost = +{ + NAMED_PARAM (GP2GP, 2), + NAMED_PARAM (GP2FP, 2), + NAMED_PARAM (FP2GP, 6), + NAMED_PARAM (FP2FP, 4) +}; + +/* Vector instruction cost model */ +NEED_EXTENSION +static const struct cpu_vector_cost generic_vector_cost = +{ + NAMED_PARAM (scalar_stmt_cost, 1), + NAMED_PARAM (scalar_load_cost, 1), + NAMED_PARAM (scalar_store_cost, 1), + NAMED_PARAM (vec_stmt_cost, 1), + NAMED_PARAM (vec_to_scalar_cost, 1), + NAMED_PARAM (scalar_to_vec_cost, 1), + NAMED_PARAM (vec_align_load_cost, 1), + NAMED_PARAM (vec_unalign_load_cost, 1), + NAMED_PARAM (vec_unalign_store_cost, 1), + NAMED_PARAM (vec_store_cost, 1), + NAMED_PARAM (cond_taken_branch_cost, 3), + NAMED_PARAM (cond_not_taken_branch_cost, 1) +}; + +NEED_EXTENSION +static const struct cpu_vector_cost cortexa57_vector_cost = +{ + NAMED_PARAM (scalar_stmt_cost, 1), + NAMED_PARAM (scalar_load_cost, 4), + NAMED_PARAM (scalar_store_cost, 1), + NAMED_PARAM (vec_stmt_cost, 3), + NAMED_PARAM (vec_to_scalar_cost, 8), + NAMED_PARAM (scalar_to_vec_cost, 8), + NAMED_PARAM (vec_align_load_cost, 5), + NAMED_PARAM (vec_unalign_load_cost, 5), + NAMED_PARAM (vec_unalign_store_cost, 1), + NAMED_PARAM (vec_store_cost, 1), + NAMED_PARAM (cond_taken_branch_cost, 1), + NAMED_PARAM (cond_not_taken_branch_cost, 1) +}; #endif Index: config/aarch64/aarch64.c =================================================================== --- config/aarch64/aarch64.c (revision 216524) +++ config/aarch64/aarch64.c (working copy) @@ -157,142 +157,8 @@ unsigned long aarch64_isa_flags = 0; /* Mask to specify which instruction scheduling options should be used. */ unsigned long aarch64_tune_flags = 0; -/* Tuning parameters. */ - -#if HAVE_DESIGNATED_INITIALIZERS -#define NAMED_PARAM(NAME, VAL) .NAME = (VAL) -#else -#define NAMED_PARAM(NAME, VAL) (VAL) -#endif - -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif - -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif -static const struct cpu_addrcost_table generic_addrcost_table = -{ -#if HAVE_DESIGNATED_INITIALIZERS - .addr_scale_costs = -#endif - { - NAMED_PARAM (hi, 0), - NAMED_PARAM (si, 0), - NAMED_PARAM (di, 0), - NAMED_PARAM (ti, 0), - }, - NAMED_PARAM (pre_modify, 0), - NAMED_PARAM (post_modify, 0), - NAMED_PARAM (register_offset, 0), - NAMED_PARAM (register_extend, 0), - NAMED_PARAM (imm_offset, 0) -}; - -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif -static const struct cpu_addrcost_table cortexa57_addrcost_table = -{ -#if HAVE_DESIGNATED_INITIALIZERS - .addr_scale_costs = -#endif - { - NAMED_PARAM (hi, 1), - NAMED_PARAM (si, 0), - NAMED_PARAM (di, 0), - NAMED_PARAM (ti, 1), - }, - NAMED_PARAM (pre_modify, 0), - NAMED_PARAM (post_modify, 0), - NAMED_PARAM (register_offset, 0), - NAMED_PARAM (register_extend, 0), - NAMED_PARAM (imm_offset, 0), -}; - -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif -static const struct cpu_regmove_cost generic_regmove_cost = -{ - NAMED_PARAM (GP2GP, 1), - NAMED_PARAM (GP2FP, 2), - NAMED_PARAM (FP2GP, 2), - NAMED_PARAM (FP2FP, 2) -}; - -static const struct cpu_regmove_cost cortexa57_regmove_cost = -{ - NAMED_PARAM (GP2GP, 1), - /* Avoid the use of slow int<->fp moves for spilling by setting - their cost higher than memmov_cost. */ - NAMED_PARAM (GP2FP, 5), - NAMED_PARAM (FP2GP, 5), - NAMED_PARAM (FP2FP, 2) -}; - -static const struct cpu_regmove_cost cortexa53_regmove_cost = -{ - NAMED_PARAM (GP2GP, 1), - /* Avoid the use of slow int<->fp moves for spilling by setting - their cost higher than memmov_cost. */ - NAMED_PARAM (GP2FP, 5), - NAMED_PARAM (FP2GP, 5), - NAMED_PARAM (FP2FP, 2) -}; - -static const struct cpu_regmove_cost thunderx_regmove_cost = -{ - NAMED_PARAM (GP2GP, 2), - NAMED_PARAM (GP2FP, 2), - NAMED_PARAM (FP2GP, 6), - NAMED_PARAM (FP2FP, 4) -}; - -/* Generic costs for vector insn classes. */ -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif -static const struct cpu_vector_cost generic_vector_cost = -{ - NAMED_PARAM (scalar_stmt_cost, 1), - NAMED_PARAM (scalar_load_cost, 1), - NAMED_PARAM (scalar_store_cost, 1), - NAMED_PARAM (vec_stmt_cost, 1), - NAMED_PARAM (vec_to_scalar_cost, 1), - NAMED_PARAM (scalar_to_vec_cost, 1), - NAMED_PARAM (vec_align_load_cost, 1), - NAMED_PARAM (vec_unalign_load_cost, 1), - NAMED_PARAM (vec_unalign_store_cost, 1), - NAMED_PARAM (vec_store_cost, 1), - NAMED_PARAM (cond_taken_branch_cost, 3), - NAMED_PARAM (cond_not_taken_branch_cost, 1) -}; - -/* Generic costs for vector insn classes. */ -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif -static const struct cpu_vector_cost cortexa57_vector_cost = -{ - NAMED_PARAM (scalar_stmt_cost, 1), - NAMED_PARAM (scalar_load_cost, 4), - NAMED_PARAM (scalar_store_cost, 1), - NAMED_PARAM (vec_stmt_cost, 3), - NAMED_PARAM (vec_to_scalar_cost, 8), - NAMED_PARAM (scalar_to_vec_cost, 8), - NAMED_PARAM (vec_align_load_cost, 5), - NAMED_PARAM (vec_unalign_load_cost, 5), - NAMED_PARAM (vec_unalign_store_cost, 1), - NAMED_PARAM (vec_store_cost, 1), - NAMED_PARAM (cond_taken_branch_cost, 1), - NAMED_PARAM (cond_not_taken_branch_cost, 1) -}; - -#if HAVE_DESIGNATED_INITIALIZERS && GCC_VERSION >= 2007 -__extension__ -#endif +/* The tuning structures. The cost model tables are in aarch64-cost-tables.h */ +NEED_EXTENSION static const struct tune_params generic_tunings = { &cortexa57_extra_costs, @@ -303,6 +169,7 @@ static const struct tune_params generic_ NAMED_PARAM (issue_rate, 2) }; +NEED_EXTENSION static const struct tune_params cortexa53_tunings = { &cortexa53_extra_costs, @@ -313,6 +180,7 @@ static const struct tune_params cortexa5 NAMED_PARAM (issue_rate, 2) }; +NEED_EXTENSION static const struct tune_params cortexa57_tunings = { &cortexa57_extra_costs, @@ -323,6 +191,7 @@ static const struct tune_params cortexa5 NAMED_PARAM (issue_rate, 3) }; +NEED_EXTENSION static const struct tune_params thunderx_tunings = { &thunderx_extra_costs,