From patchwork Wed Feb 2 00:22:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 50661 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB5B93857C47 for ; Wed, 2 Feb 2022 00:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB5B93857C47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643761404; bh=koNAHmQB2g4BkN0ra7LJ5CrD5xcf1GZBgVmM8r4wkIA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=bREnxmtR8ujfXIvByVlXhDo9Zy6t2GcLtuzehJ1jS/yElZy+L9P/i+lnDfnMZNT9w t86hgYWVkI57VSNuQX9nRSwQDUTPRem9RJePtMkoe/qOuXwdxESJJre2ktQkMgnLFU 9YNxWd3wKW3Is017Wkk3kocWVylhbLHJoYyIEC1w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id 853DB385BF86 for ; Wed, 2 Feb 2022 00:22:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 853DB385BF86 To: Subject: [PATCH 1/5] cris: Don't default to -mmul-bug-workaround MIME-Version: 1.0 Message-ID: <20220202002221.218BE20438@pchp3.se.axis.com> Date: Wed, 2 Feb 2022 01:22:21 +0100 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-Patchwork-Original-From: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This flips the default for the errata handling for an old version (TL;DR: workaround: no multiply instruction last on a cache-line). Newer versions of the CRIS cpu don't have that bug. While the impact of the workaround is very marginal (coremark: less than .05% larger, less than .0005% slower) it's an irritating pseudorandom factor when assessing the impact of other changes. Also, fix a wart requiring changes to more than TARGET_DEFAULT to flip the default. People building old kernels or operating systems to run on ETRAX 100 LX are advised to pass "-mmul-bug-workaround". gcc: * config/cris/cris.h (TARGET_DEFAULT): Don't include MASK_MUL_BUG. (MUL_BUG_ASM_DEFAULT): New macro. (MAYBE_AS_NO_MUL_BUG_ABORT): Define in terms of MUL_BUG_ASM_DEFAULT. * doc/invoke.texi (CRIS Options, -mmul-bug-workaround): Adjust accordingly. --- gcc/config/cris/cris.h | 19 ++++++++++++++++--- gcc/doc/invoke.texi | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index b274e1166203..9245d7886929 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -153,7 +153,9 @@ extern int cris_cpu_version; #ifdef HAVE_AS_NO_MUL_BUG_ABORT_OPTION #define MAYBE_AS_NO_MUL_BUG_ABORT \ - "%{mno-mul-bug-workaround:-no-mul-bug-abort} " + "%{mno-mul-bug-workaround:-no-mul-bug-abort} " \ + "%{mmul-bug-workaround:-mul-bug-abort} " \ + "%{!mmul-bug-workaround:%{!mno-mul-bug-workaround:" MUL_BUG_ASM_DEFAULT "}} " #else #define MAYBE_AS_NO_MUL_BUG_ABORT #endif @@ -255,15 +257,26 @@ extern int cris_cpu_version; (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \ + MASK_CONST_ALIGN + MASK_DATA_ALIGN \ + MASK_ALIGN_BY_32 \ - + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG) + + MASK_PROLOGUE_EPILOGUE) # else /* 0 */ # define TARGET_DEFAULT \ (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \ + MASK_CONST_ALIGN + MASK_DATA_ALIGN \ - + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG) + + MASK_PROLOGUE_EPILOGUE) # endif #endif +/* Don't depend on the assembler default setting for the errata machinery; + always pass the option to turn it on or off explicitly. But, we have to + decide on which is the *GCC* default, and for that we should only need to + consider what's in TARGET_DEFAULT; no other changes should be necessary. */ + +#if (TARGET_DEFAULT & MASK_MUL_BUG) +#define MUL_BUG_ASM_DEFAULT "-mul-bug-abort" +#else +#define MUL_BUG_ASM_DEFAULT "-no-mul-bug-abort" +#endif + /* Local, providing a default for cris_cpu_version. */ #define CRIS_DEFAULT_CPU_VERSION TARGET_CPU_DEFAULT diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index cfd415110cdf..7af5c51cc3c7 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -22268,7 +22268,7 @@ The options @option{-metrax4} and @option{-metrax100} are synonyms for @opindex mmul-bug-workaround @opindex mno-mul-bug-workaround Work around a bug in the @code{muls} and @code{mulu} instructions for CPU -models where it applies. This option is active by default. +models where it applies. This option is disabled by default. @item -mpdebug @opindex mpdebug