From patchwork Thu Oct 15 06:38:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Hainque X-Patchwork-Id: 1382473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=jtFxcq/G; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CBfjy0WJGz9sT6 for ; Thu, 15 Oct 2020 17:38:14 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AEADF39450EC; Thu, 15 Oct 2020 06:38:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 9B89239450EA for ; Thu, 15 Oct 2020 06:38:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9B89239450EA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hainque@adacore.com Received: by mail-wr1-x434.google.com with SMTP id x7so1953699wrl.3 for ; Wed, 14 Oct 2020 23:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Ewg46sJHnmd19GlLmK+VVz/L3brQiRDiivGzwbs3ELc=; b=jtFxcq/GX4rSTJQ6nGoPEHfvimu+8tMAZ+e/ZUvyuSFZczBo45rf3yGYnEOHNnyD9G txEKLIDyIWdZO9N5MkBN9gI94vFgyYQ2/cG1/Mn0621B/H9Qe3X+D48pYyl0GywilOdQ +cl+YiK4bn6zh+ytAC2Lj1WIWGCijsKK2ZarT78Wik0TLJzW2+ni7U2KgRqM8NzXft5w Vd4D6yYSpSPidfC/j5MXLV6H1pJynshLd2uc9Nmois/raAnDofdMx8W/7nPJ8uS53X7j zXthDWtPtx7Y+ktwOVx/zqEIalBlKjpjVCr/7Xv2FMQtazkCGGhcGY7mhS3xuvKrbJ95 LfIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Ewg46sJHnmd19GlLmK+VVz/L3brQiRDiivGzwbs3ELc=; b=o0CY0lb9TSZ430j8YyPbCvLZO/srn5BvXJwD0jAXgIWJU0fNk0OWOEbteLOZFX4nWH prKh1awEgy0joG683rHD8PejUB9e/FY6rlpUwRLnYiETogvw/wmd11eGqCUOr7C92SBO tkFaBM3Kd5GVLIPq81CI9kDM8XKD1F6v5rCncaBpdgcYFTTKp6LJmryr52sfv+TU/cjD mWxe7IvzYFNGwS/OyovdDqq8w2L+8OiQAuyruZ8KaIaKseHjI4DQ3or/Tjh3PammGRbU tmHt+81TodIxPpjGNoOUtZ1iGeVZfDQQBVzBoo69v7JTpJ58Us3PuN1zBne1GrWtmtmi wnVg== X-Gm-Message-State: AOAM532ZS3BFbDBOJo6Fp1Ryn9Bn9uiEyhfEhff2E8g3NP0EtxcnoM+Z /nSaXO2hXlLy+E5LxdkoPku7VpgaSMtqKOnU X-Google-Smtp-Source: ABdhPJxCNu1OMuP1AWiY5GIQhUI8Bx5ybvVkFDWCq2G6NgMXPkpYB9IVGwDurzQIxNZusH66ob/HIw== X-Received: by 2002:adf:9043:: with SMTP id h61mr2500259wrh.237.1602743888286; Wed, 14 Oct 2020 23:38:08 -0700 (PDT) Received: from imac-2020.home (2a01cb040080d100cd75a8be7e10240a.ipv6.abo.wanadoo.fr. [2a01:cb04:80:d100:cd75:a8be:7e10:240a]) by smtp.gmail.com with ESMTPSA id i126sm3217995wmi.0.2020.10.14.23.38.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2020 23:38:07 -0700 (PDT) From: Olivier Hainque Message-Id: <1B71130A-609B-40D9-9CE6-1014EED0C864@adacore.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: [ping] aarch64: move and adjust PROBE_STACK_*_REG Date: Thu, 15 Oct 2020 08:38:07 +0200 In-Reply-To: To: GCC Patches References: X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Ping, please ? Patch re-attached for convenience. Thanks in advance! Best Regards, Olivier > On 24 Sep 2020, at 11:46, Olivier Hainque wrote: > > Re-proposing this patch after re-testing with a recent > mainline on on aarch64-linux (bootstrap and regression test > with --enable-languages=all), and more than a year of in-house > use in production for a few aarch64 ports on a gcc-9 base. > > The change moves the definitions of PROBE_STACK_FIRST_REG > and PROBE_STACK_SECOND_REG to a more appropriate place for such > items (here, in aarch64.md as suggested by Richard), and adjusts > their value from r9/r10 to r10/r11 to free r9 for a possibly > more general purpose (e.g. as a static chain at least on targets > which have a private use of r18, such as Windows or Vxworks). > > OK to commit? > > Thanks in advance, > > With Kind Regards, > > Olivier > > 2020-11-07 Olivier Hainque > > * config/aarch64/aarch64.md: Define PROBE_STACK_FIRST_REGNUM > and PROBE_STACK_SECOND_REGNUM constants, designating r10/r11. > Replacements for the PROBE_STACK_FIRST/SECOND_REG constants in > aarch64.c. > * config/aarch64/aarch64.c (PROBE_STACK_FIRST_REG): Remove. > (PROBE_STACK_SECOND_REG): Remove. > (aarch64_emit_probe_stack_range): Adjust to the _REG -> _REGNUM > suffix update for PROBE_STACK register numbers. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index b6d74496cd0..5e94e4b1a79 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6200,10 +6200,6 @@ aarch64_libgcc_cmp_return_mode (void) #error Cannot use simple address calculation for stack probing #endif -/* The pair of scratch registers used for stack probing. */ -#define PROBE_STACK_FIRST_REG R9_REGNUM -#define PROBE_STACK_SECOND_REG R10_REGNUM - /* Emit code to probe a range of stack addresses from FIRST to FIRST+POLY_SIZE, inclusive. These are offsets from the current stack pointer. */ @@ -6217,7 +6213,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size) return; } - rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REG); + rtx reg1 = gen_rtx_REG (Pmode, PROBE_STACK_FIRST_REGNUM); /* See the same assertion on PROBE_INTERVAL above. */ gcc_assert ((first % ARITH_FACTOR) == 0); @@ -6275,7 +6271,7 @@ aarch64_emit_probe_stack_range (HOST_WIDE_INT first, poly_int64 poly_size) equality test for the loop condition. */ else { - rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REG); + rtx reg2 = gen_rtx_REG (Pmode, PROBE_STACK_SECOND_REGNUM); /* Step 1: round SIZE to the previous multiple of the interval. */ diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 9b20dd0b1a0..df5533e113b 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -111,6 +111,10 @@ ;; "FFR token": a fake register used for representing the scheduling ;; restrictions on FFR-related operations. (FFRT_REGNUM 85) + ;; The pair of scratch registers used for stack probing with -fstack-check. + ;; Leave R9 alone as a possible choice for the static chain. + (PROBE_STACK_FIRST_REGNUM 10) + (PROBE_STACK_SECOND_REGNUM 11) ;; Scratch register used by stack clash protection to calculate ;; SVE CFA offsets during probing. (STACK_CLASH_SVE_CFA_REGNUM 11)