From patchwork Fri Jul 27 09:37:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 143024 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp599999ljj; Fri, 27 Jul 2018 02:40:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe78Ju4IqMhlM/Py1Rebs868nhFPmtUa+cX/V6CZkVubsCE4MUdjKGZiN1t9bwah9/KIDon X-Received: by 2002:a17:902:bb0d:: with SMTP id l13-v6mr5458164pls.5.1532684433050; Fri, 27 Jul 2018 02:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532684433; cv=none; d=google.com; s=arc-20160816; b=l38s4vEChGJiQrU8+leawrlgew2nTtBd1p2h3/zfsV7Az3qXxitkl8wunXYOx3RDp1 1rxDQRdgqa5MnIKxMIVDuffB4e22sjSWslZrYbHIF+QZMmr32Z0C30HVSWxO8ayK0vk3 oercilkeggWWRzNCIKnEjQDkfHAOKoeZDBDmATzseXx3xWE5rx/HZYZ3om0BxpG0gAty 1a2TUuIZrVMRWaqtcaIRXFhTMcykAT8ilmQyCeWaq9dcTnHroWpgGRWoJDIbcpkwnNjW vdSD3rzrmb73KGBW+Nkcc9HZoC6JgQbT4S/xLd9vWaUJB5WB74GpekiMyAG68ajt0u3S qYZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=9dB6TBlbPYHQrGKJOIGWpjUzEvKlEGF3a3kOyyfJ8vk=; b=yf11mgjuAcz/lFHEFOMtUV4nLE+jOIE/VoL3qzFGQPfcQ7DuorInzkJMEZ+7+ccXoC u1pL8hx2BQjlWE1OCbfFj9Ead4j+PBJvRZbap0JDXlR7QoxahAw5K/thV77ha0UwoqqB jwngdx5UTQSo/FDCsVnNu330cdSWqaiSzSw+tc9lOXgweHCw9fuX4qNv7OQ2NFM2hp75 ZdbVsKR2b/UCCY9mmEFeZMWgH3ZZvMAL8K+sfa9yrOZR22jJYO7foN2XPORkrxk2UR8S c5AO6V/K4aDXQkMwcPZTq+BVBQaeAOKGdNVGgQluTJ+ufpXfYrphnd/PxjqqbJaTf9zB g0mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=k1RzQ8uN; spf=pass (google.com: domain of gcc-patches-return-482510-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-482510-patch=linaro.org@gcc.gnu.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 43-v6si3228760plc.30.2018.07.27.02.40.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 02:40:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-482510-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=k1RzQ8uN; spf=pass (google.com: domain of gcc-patches-return-482510-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-482510-patch=linaro.org@gcc.gnu.org" 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-type; q=dns; s=default; b=WMcJO2ZgAPcmpHAR BvzWH/VxEzzSipkUXdu48Q6RGYalvHAxyU/HUhuLT+Ef7r10z870Q1aZGc6Mj9kK 17nNq3lOEMNwLGNO4YrsNjRqzAU7PU22kU+hb77nGu1I8XLYUiXtrKgWjoxmDOaX PPl7ZOuWNrrydJu/E4QOloSYulk= 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-type; s=default; bh=TcYsc1UtBxEnYX3+7/SJAN OGj20=; b=k1RzQ8uNZSzidkeWYTnF7Cl2ZGRr16GFh3M7rmaJC/5oI/6KPqG+e0 9hFB8pouHpYFQOC1bG9UZLGjKvo+8wBtbotPX9cGAI4BtQ0OcLzvWKKxH7gRIroO KnyPzqJBzD5+aNt2nA4Sf997jd3N1Y4DwBtcIRkvcjrVIN+v23KXk= Received: (qmail 48143 invoked by alias); 27 Jul 2018 09:38:40 -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 47984 invoked by uid 89); 27 Jul 2018 09:38:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_FAIL autolearn=ham version=3.3.2 spammy= X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Jul 2018 09:38:36 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fizCh-0006DV-5T for gcc-patches@gcc.gnu.org; Fri, 27 Jul 2018 05:38:34 -0400 Received: from foss.arm.com ([217.140.101.70]:47232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fizCg-0006BH-PV for gcc-patches@gcc.gnu.org; Fri, 27 Jul 2018 05:38:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D0281684; Fri, 27 Jul 2018 02:38:30 -0700 (PDT) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.207.74]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C60D03F575; Fri, 27 Jul 2018 02:38:29 -0700 (PDT) From: Richard Earnshaw To: gcc-patches@gcc.gnu.org, rguenther@suse.de Cc: Richard Earnshaw Subject: [PATCH 08/11] targhooks - provide an alternative hook for targets that never execute speculatively Date: Fri, 27 Jul 2018 10:37:52 +0100 Message-Id: <1532684275-13041-9-git-send-email-Richard.Earnshaw@arm.com> In-Reply-To: <1532684275-13041-1-git-send-email-Richard.Earnshaw@arm.com> References: <1531154299-28349-1-git-send-email-Richard.Earnshaw@arm.com> <1532684275-13041-1-git-send-email-Richard.Earnshaw@arm.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.140.101.70 This hook adds an alternative implementation for the target hook TARGET_HAVE_SPECULATION_SAFE_VALUE; it can be used by targets that have no CPU implementations that execute code speculatively. All that is needed for such targets now is to add: #undef TARGET_HAVE_SPECULATION_SAFE_VALUE #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed. to where you have your other target hooks and you're done. gcc: * targhooks.h (speculation_safe_value_not_needed): New prototype. * targhooks.c (speculation_safe_value_not_needed): New function. * target.def (have_speculation_safe_value): Update documentation. * doc/tm.texi: Regenerated. --- gcc/doc/tm.texi | 5 +++++ gcc/target.def | 7 ++++++- gcc/targhooks.c | 7 +++++++ gcc/targhooks.h | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 15b0ab8..f36e376 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -11959,6 +11959,11 @@ This hook is used to determine the level of target support for a pattern named @code{speculation_barrier}. Else it returns true for the first case and whether the pattern is enabled for the current compilation for the second case. + + For targets that have no processors that can execute instructions + speculatively an alternative implemenation of this hook is available: + simply redefine this hook to @code{speculation_safe_value_not_needed} + along with your other target hooks. @end deftypefn @deftypefn {Target Hook} rtx TARGET_SPECULATION_SAFE_VALUE (machine_mode @var{mode}, rtx @var{result}, rtx @var{val}, rtx @var{failval}) diff --git a/gcc/target.def b/gcc/target.def index d598067..5599eb4 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4206,7 +4206,12 @@ DEFHOOK The default implementation returns false if the target does not define\n\ a pattern named @code{speculation_barrier}. Else it returns true\n\ for the first case and whether the pattern is enabled for the current\n\ - compilation for the second case.", + compilation for the second case.\n\ + \n\ + For targets that have no processors that can execute instructions\n\ + speculatively an alternative implemenation of this hook is available:\n\ + simply redefine this hook to @code{speculation_safe_value_not_needed}\n\ + along with your other target hooks.", bool, (bool active), default_have_speculation_safe_value) DEFHOOK diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 06de1e3..62051a9 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -2324,6 +2324,13 @@ default_have_speculation_safe_value (bool active) return false; #endif } +/* Alternative implementation of TARGET_HAVE_SPECULATION_SAFE_VALUE + that can be used on targets that never have speculative execution. */ +bool +speculation_safe_value_not_needed (bool active) +{ + return !active; +} /* Default implementation of the speculation-safe-load builtin. This implementation simply copies val to result and generates a diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 74ffe5f..b716b97 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -286,6 +286,7 @@ extern void default_select_early_remat_modes (sbitmap); extern tree default_preferred_else_value (unsigned, tree, unsigned, tree *); extern bool default_have_speculation_safe_value (bool); +extern bool speculation_safe_value_not_needed (bool); extern rtx default_speculation_safe_value (machine_mode, rtx, rtx, rtx); #endif /* GCC_TARGHOOKS_H */