From patchwork Wed Mar 6 10:20:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu X-Patchwork-Id: 1052236 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-497443-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="azlTKYpi"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ny5nH7fB"; 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 44DqXk07dCz9s70 for ; Wed, 6 Mar 2019 21:20:53 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=yay Fw5zjA7/dtcgPxC008mhnGxPsT+63v556f7gDmVDja1q9Gft0sE1UU4uMAIfM7Oh xM6GwYW6GLeFB9JBFXVmDYN4xnTMxUWyiaJldurm95KUnzkbpYPeKYik96x2CQIz maG2y7teiBq4/0ixnLFBmDnXsE5RiEseUNRVlUf4= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=pFWOcACX4 xwy5Cc/YCAT2Ais3s8=; b=azlTKYpi6xB+3gTECWsxSTgnfbOam0CmYy//NlHy8 5ad8S9IZZ8TSEGyp19IS1wMS+cuyJhctBc+ybHebqbVRc2wu9tzjx5ennh99Amwh kUt+LQNYY7jHKfBla9qDhXkZOkaV0kni2tIOgeW8izLAXwK1RkRlPtI4ji2fzsoY K4= Received: (qmail 102317 invoked by alias); 6 Mar 2019 10:20:22 -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 102206 invoked by uid 89); 6 Mar 2019 10:20:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4554, gen_rtx_SET, pic, gen_rtx_set X-HELO: mail-yw1-f49.google.com Received: from mail-yw1-f49.google.com (HELO mail-yw1-f49.google.com) (209.85.161.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Mar 2019 10:20:19 +0000 Received: by mail-yw1-f49.google.com with SMTP id k14so9511146ywe.4 for ; Wed, 06 Mar 2019 02:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YGSBzmmCLgBw8RtnzXD/uu9uBttJxujzyLCjVU1EO6c=; b=Ny5nH7fBZs7selZlDx4S6H+qMkEqJqkc5gU/qU1NlZLan+XeJa0gfhMCBrIuaC/gDl aIOb+ODUkLKWpjT0N59TGV49A1U2952wGRsxmQNSkOizzOxZMBJ183ZhHHo1TUmDLzfl Kjj8x3Gt0TgD2rn+ssksan/TdNGyg8pi9wnIRyQoZ16WacXs6h46guATpkDkeGv2Uolq Ob345HoONaaZn0L3WaizmD/OnLLQNNlJCkgN3F6NmsXLVsMYPpxw02QEI7V/SaQb+MXi mWTMDJcGMnXL7ab/3Y8XITLY/1btE7MoJv9IsVuoWLlpvXc3NwkLqd+JbnTZjMHUiZ+a dbuQ== Received: from localhost.localdomain ([193.187.151.25]) by smtp.gmail.com with ESMTPSA id d85sm403718ywd.96.2019.03.06.02.20.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Mar 2019 02:20:17 -0800 (PST) From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com, andrew.burgess@embecosm.com, claziss@synopsys.com Subject: [PATCH 2/5] [ARC] Enable code density frame option for elf targets. Date: Wed, 6 Mar 2019 12:20:02 +0200 Message-Id: <20190306102005.15413-3-claziss@gmail.com> In-Reply-To: <20190306102005.15413-1-claziss@gmail.com> References: <20190306102005.15413-1-claziss@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.opt (mcode-density-frame): Get the inital value from TARGET_CODE_DENSITY_FRAME_DEFAULT. * config/arc/elf.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define it to 1. * config/arc/linux.h (TARGET_CODE_DENSITY_FRAME_DEFAULT): Define it to 0. --- gcc/config/arc/arc.c | 5 ++++- gcc/config/arc/arc.md | 20 ++++++++++---------- gcc/config/arc/arc.opt | 2 +- gcc/config/arc/elf.h | 4 ++++ gcc/config/arc/linux.h | 4 ++++ 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 0b18e677735..9e086477027 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -1292,6 +1292,9 @@ arc_override_options (void) if (arc_size_opt_level == 3) optimize_size = 1; + if (TARGET_V2 && optimize_size && (ATTRIBUTE_PCS == 2)) + TARGET_CODE_DENSITY_FRAME = 1; + if (flag_pic) { /* If we had SDATA enabled, still don't use GP when pic is @@ -3188,7 +3191,7 @@ arc_save_callee_enter (unsigned int gmask, reg = gen_rtx_SET (stack_pointer_rtx, plus_constant (Pmode, stack_pointer_rtx, - nregs * UNITS_PER_WORD)); + -nregs * UNITS_PER_WORD)); RTX_FRAME_RELATED_P (reg) = 1; XVECEXP (insn, 0, indx++) = reg; off = nregs * UNITS_PER_WORD; diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 54d073107a8..c64a7fdb653 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -6442,7 +6442,7 @@ core_3, archs4x, archs4xd, archs4xd_slow" (plus:SI (reg:SI SP_REG) (match_operand 1 "immediate_operand" ""))) (set (mem:SI (plus:SI (reg:SI SP_REG) - (match_dup 1))) + (match_operand 2 "immediate_operand" ""))) (reg:SI 13))])] "TARGET_CODE_DENSITY" { @@ -6450,14 +6450,14 @@ core_3, archs4x, archs4xd, archs4xd_slow" rtx tmp = XVECEXP (operands[0], 0, len - 1); if (MEM_P (XEXP (tmp, 0))) { - operands[2] = XEXP (tmp, 1); - return "enter_s\\t{r13-%2} ; sp=sp-%1"; + operands[3] = XEXP (tmp, 1); + return "enter_s\\t{r13-%3} ; sp=sp+(%1)"; } else { tmp = XVECEXP (operands[0], 0, len - 3); - operands[2] = XEXP (tmp, 1); - return "enter_s\\t{r13-%2, fp} ; sp=sp-%1"; + operands[3] = XEXP (tmp, 1); + return "enter_s\\t{r13-%3, fp} ; sp=sp+(%1)"; } } [(set_attr "type" "call_no_delay_slot") @@ -6469,7 +6469,7 @@ core_3, archs4x, archs4xd, archs4xd_slow" (plus:SI (reg:SI SP_REG) (match_operand 1 "immediate_operand" ""))) (set (mem:SI (plus:SI (reg:SI SP_REG) - (match_dup 1))) + (match_operand 2 "immediate_operand" ""))) (reg:SI RETURN_ADDR_REGNUM))])] "TARGET_CODE_DENSITY" { @@ -6477,14 +6477,14 @@ core_3, archs4x, archs4xd, archs4xd_slow" rtx tmp = XVECEXP (operands[0], 0, len - 1); if (MEM_P (XEXP (tmp, 0))) { - operands[2] = XEXP (tmp, 1); - return "enter_s\\t{r13-%2, blink} ; sp=sp-%1"; + operands[3] = XEXP (tmp, 1); + return "enter_s\\t{r13-%3, blink} ; sp=sp+(%1)"; } else { tmp = XVECEXP (operands[0], 0, len - 3); - operands[2] = XEXP (tmp, 1); - return "enter_s\\t{r13-%2, fp, blink} ; sp=sp-%1"; + operands[3] = XEXP (tmp, 1); + return "enter_s\\t{r13-%3, fp, blink} ; sp=sp+(%1)"; } } [(set_attr "type" "call_no_delay_slot") diff --git a/gcc/config/arc/arc.opt b/gcc/config/arc/arc.opt index a5271cbbceb..567df30951f 100644 --- a/gcc/config/arc/arc.opt +++ b/gcc/config/arc/arc.opt @@ -537,5 +537,5 @@ Target Report Var(TARGET_BRANCH_INDEX) Init(DEFAULT_BRANCH_INDEX) Enable use of BI/BIH instructions when available. mcode-density-frame -Target Report Var(TARGET_CODE_DENSITY_FRAME) +Target Report Var(TARGET_CODE_DENSITY_FRAME) Init(TARGET_CODE_DENSITY_FRAME_DEFAULT) Enable ENTER_S and LEAVE_S opcodes for ARCv2. diff --git a/gcc/config/arc/elf.h b/gcc/config/arc/elf.h index 8f9bec05606..651741f3342 100644 --- a/gcc/config/arc/elf.h +++ b/gcc/config/arc/elf.h @@ -98,3 +98,7 @@ along with GCC; see the file COPYING3. If not see fixed_regs[GP_REG] = 0; \ arc_regno_reg_class[GP_REG] = GENERAL_REGS; \ } + +/* Enter/Leave ops are default on for elf targets. */ +#undef TARGET_CODE_DENSITY_FRAME_DEFAULT +#define TARGET_CODE_DENSITY_FRAME_DEFAULT 0 diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h index 6c8a7b46296..270ca907d87 100644 --- a/gcc/config/arc/linux.h +++ b/gcc/config/arc/linux.h @@ -133,3 +133,7 @@ along with GCC; see the file COPYING3. If not see fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); \ emit_library_call (fun, LCT_NORMAL, VOIDmode, rt, Pmode); \ } + +/* Enter/Leave ops are default off for linux targets. */ +#undef TARGET_CODE_DENSITY_FRAME_DEFAULT +#define TARGET_CODE_DENSITY_FRAME_DEFAULT 0