public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work104)] Tweak setting precision.
@ 2023-01-10  4:19 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2023-01-10  4:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d7bfd5dbe596a643b98a7add1961aca3718457b2

commit d7bfd5dbe596a643b98a7add1961aca3718457b2
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Mon Jan 9 23:18:43 2023 -0500

    Tweak setting precision.
    
    2022-01-09   Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/rs6000.cc (rs6000_option_override_internal): Make unqiue
            float128 precision a user switch.
            * config/rs6000/rs6000.opt (-munique-float128-precision): Likewise.
            * genmodes.cc (emit_mode_adjustments): Set mode_precision as well as
            mode_unit_precision.

Diff:
---
 gcc/config/rs6000/rs6000.cc  |  3 ++-
 gcc/config/rs6000/rs6000.opt | 17 +++++++++--------
 gcc/genmodes.cc              |  5 ++++-
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 15cefd4e4c1..aa7818de5bc 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -4171,7 +4171,8 @@ rs6000_option_override_internal (bool global_init_p)
 
 /* Fortran needs to have precisions of 126..128 to differentiate between IEEE
    and IBM 128-bit floating point.  */
-  UNIQUE_FLOAT128_PRECISION = lang_GNU_Fortran ();
+  if (!OPTION_SET_P (UNIQUE_FLOAT128_PRECISION))
+    UNIQUE_FLOAT128_PRECISION = lang_GNU_Fortran ();
 
   /* IEEE 128-bit floating point requires VSX support.  */
   if (TARGET_FLOAT128_KEYWORD)
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index cab848c9836..5e259f881af 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -108,14 +108,6 @@ unsigned char x_TARGET_FLOAT128_TYPE
 Variable
 unsigned char TARGET_FLOAT128_TYPE
 
-;; Whether each of the 3 128-bit floating point modes (IFmode, KFmode, and
-;; TFmode) have a unique precision number, or whether they all use 128.  C
-;; and C++ prefer the precision to be 128, but fortran prefers to have
-;; separate precisions to differentiate between IBM and IEEE 128-bit floating
-;; point.
-TargetVariable
-bool UNIQUE_FLOAT128_PRECISION
-
 ;; This option existed in the past, but now is always on.
 mpowerpc
 Target RejectNegative Undocumented Ignore
@@ -557,6 +549,15 @@ mstack-protector-guard=
 Target RejectNegative Joined Enum(stack_protector_guard) Var(rs6000_stack_protector_guard) Init(SSP_TLS)
 Use given stack-protector guard.
 
+;; Whether each of the 3 128-bit floating point modes (IFmode, KFmode, and
+;; TFmode) have a unique precision number, or whether they all use 128.  C
+;; and C++ prefer the precision to be 128, but fortran prefers to have
+;; separate precisions to differentiate between IBM and IEEE 128-bit floating
+;; point.
+munique-float128-precision
+Target Undocumented Var(UNIQUE_FLOAT128_PRECISION)
+Each 128-bit floating point type gets a unqiue precision.
+
 Enum
 Name(stack_protector_guard) Type(enum stack_protector_guard)
 Valid arguments to -mstack-protector-guard=:
diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
index 1057c8a7981..270833c6dfc 100644
--- a/gcc/genmodes.cc
+++ b/gcc/genmodes.cc
@@ -1998,6 +1998,7 @@ emit_mode_adjustments (void)
     {
       printf ("\n  /* %s:%d */\n  s = %s;\n",
 	      a->file, a->line, a->adjustment);
+      printf ("  mode_precision[E_%smode] = s;\n", a->mode->name);
       printf ("  mode_unit_precision[E_%smode] = s;\n", a->mode->name);
 
       for (m = a->mode->contained; m; m = m->next_cont)
@@ -2006,7 +2007,8 @@ emit_mode_adjustments (void)
 	    {
 	    case MODE_COMPLEX_INT:
 	    case MODE_COMPLEX_FLOAT:
-	      printf ("  mode_unit_precision[E_%smode] = s;\n", m->name);
+	      printf ("  mode_precision[E_%smode] = 2*s;\n", m->name);
+	      printf ("  mode_unit_precision[E_%smode] = 2*s;\n", m->name);
 	      break;
 
 	    case MODE_VECTOR_BOOL:
@@ -2019,6 +2021,7 @@ emit_mode_adjustments (void)
 	    case MODE_VECTOR_UFRACT:
 	    case MODE_VECTOR_ACCUM:
 	    case MODE_VECTOR_UACCUM:
+	      printf ("  mode_precision[E_%smode] = s;\n", m->name);
 	      printf ("  mode_unit_precision[E_%smode] = %d*s;\n",
 		      m->name, m->ncomponents);
 	      break;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-10  4:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10  4:19 [gcc(refs/users/meissner/heads/work104)] Tweak setting precision Michael Meissner

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).