public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Hans-Peter Nilsson <hp@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6987] cris: Don't default to -mmul-bug-workaround
Date: Wed,  2 Feb 2022 00:20:29 +0000 (GMT)	[thread overview]
Message-ID: <20220202002029.32A473858437@sourceware.org> (raw)

https://gcc.gnu.org/g:4c4d0af4c94ccf0cfa74c8b13b8ec1029f57cd63

commit r12-6987-g4c4d0af4c94ccf0cfa74c8b13b8ec1029f57cd63
Author: Hans-Peter Nilsson <hp@axis.com>
Date:   Wed Feb 2 00:00:09 2022 +0100

    cris: Don't default to -mmul-bug-workaround
    
    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.

Diff:
---
 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 b274e116620..9245d788692 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 cfd415110cd..7af5c51cc3c 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


                 reply	other threads:[~2022-02-02  0:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220202002029.32A473858437@sourceware.org \
    --to=hp@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).