public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work104)] Tweak last change.
@ 2023-01-06 18:27 Michael Meissner
0 siblings, 0 replies; 2+ messages in thread
From: Michael Meissner @ 2023-01-06 18:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6a01d7e61d08483352bff628b6b0608ea57b5ea7
commit 6a01d7e61d08483352bff628b6b0608ea57b5ea7
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Fri Jan 6 13:27:39 2023 -0500
Tweak last change.
2022-01-06 Michael Meissner <meissner@linux.ibm.com>
gcc/
* expr.cc (convert_mode_scalar): Don't abort if the precision is the
same size between two floating point types, but the mode is different.
Diff:
---
gcc/expr.cc | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 15be1c8db99..c1c1e9729e8 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -345,10 +345,8 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp)
!= GET_MODE_PRECISION (to_mode))
|| (DECIMAL_FLOAT_MODE_P (from_mode)
!= DECIMAL_FLOAT_MODE_P (to_mode))
- || (REAL_MODE_FORMAT (from_mode) == &arm_bfloat_half_format
- && REAL_MODE_FORMAT (to_mode) == &ieee_half_format)
- || (REAL_MODE_FORMAT (to_mode) == &arm_bfloat_half_format
- && REAL_MODE_FORMAT (from_mode) == &ieee_half_format));
+ || (REAL_MODE_FORMAT (from_mode)
+ != REAL_MODE_FORMAT (to_mode)));
if (GET_MODE_PRECISION (from_mode) == GET_MODE_PRECISION (to_mode))
/* Conversion between decimal float and binary float, same size. */
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/meissner/heads/work104)] Tweak last change.
@ 2023-01-06 17:57 Michael Meissner
0 siblings, 0 replies; 2+ messages in thread
From: Michael Meissner @ 2023-01-06 17:57 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0c997693e7479b552987dc62ffd36709659060c7
commit 0c997693e7479b552987dc62ffd36709659060c7
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Fri Jan 6 12:57:02 2023 -0500
Tweak last change.
2022-01-06 Michael Meissner <meissner@linux.ibm.com>
gcc/
* config/rs6000/rs6000-modes.def (TFmode): Go back to using
FRACTIONAL_FLOAT_MODE.
* genmodes.cc (struct mode_data): Change no_widen field to normal_widen,
and invert sense of the field.
(blank_mode): Likewise.
(FRACTIONAL_FLOAT_MODE): Likewise.
(FRACTIONAL_FLOAT_MODE_NO_WIDEN): Likewise.
(make_float_mode): Likewise.
(cmp_modes): Sort normal widening modes ahead of non-widening modes.
(emit_mode_wider): Improve no widening support.
Diff:
---
gcc/config/rs6000/rs6000-modes.def | 2 +-
gcc/genmodes.cc | 48 ++++++++++++++++++++++++--------------
2 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-modes.def b/gcc/config/rs6000/rs6000-modes.def
index 6f93b8f7b13..571b92c4480 100644
--- a/gcc/config/rs6000/rs6000-modes.def
+++ b/gcc/config/rs6000/rs6000-modes.def
@@ -33,7 +33,7 @@ FRACTIONAL_FLOAT_MODE_NO_WIDEN (KF, 128, 16, ieee_quad_format);
/* 128-bit floating point, either IBM 128-bit or IEEE 128-bit. This is
adjusted in rs6000_option_override_internal to be the appropriate floating
point type. */
-FLOAT_MODE (TF, 16, ieee_quad_format);
+FRACTIONAL_FLOAT_MODE (TF, 128, 16, ieee_quad_format);
ADJUST_FLOAT_FORMAT (TF, (TARGET_LONG_DOUBLE_128 && !TARGET_IEEEQUAD
? &ibm_extended_format
: &ieee_quad_format));
diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
index 7848a00efea..32ee508a00e 100644
--- a/gcc/genmodes.cc
+++ b/gcc/genmodes.cc
@@ -79,7 +79,7 @@ struct mode_data
adjustment */
unsigned int int_n; /* If nonzero, then __int<INT_N> will be defined */
bool boolean;
- bool no_widen; /* Whether the type should not be listed in the
+ bool normal_widen; /* Whether the type should be listed in the
mode_wider and mode_2xwider tables. */
};
@@ -92,7 +92,7 @@ static const struct mode_data blank_mode = {
0, -1U, -1U, -1U, -1U,
0, 0, 0, 0, 0, 0,
"<unknown>", 0, 0, 0, 0, false, false, 0,
- false, false
+ false, true
};
static htab_t modes_by_name;
@@ -660,22 +660,22 @@ make_fixed_point_mode (enum mode_class cl,
#define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
#define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__, false)
-#define FRACTIONAL_FLOAT_MODE_NO_WIDEN(N, B, Y, F) \
make_float_mode (#N, B, Y, #F, __FILE__, __LINE__, true)
+#define FRACTIONAL_FLOAT_MODE_NO_WIDEN(N, B, Y, F) \
+ make_float_mode (#N, B, Y, #F, __FILE__, __LINE__, false)
static void
make_float_mode (const char *name,
unsigned int precision, unsigned int bytesize,
const char *format,
const char *file, unsigned int line,
- bool no_widen)
+ bool normal_widen)
{
struct mode_data *m = new_mode (MODE_FLOAT, name, file, line);
m->bytesize = bytesize;
m->precision = precision;
m->format = format;
- m->no_widen = no_widen;
+ m->normal_widen = normal_widen;
}
#define DECIMAL_FLOAT_MODE(N, Y, F) \
@@ -877,7 +877,13 @@ create_modes (void)
they have the same bytesize; this is the right thing because
the precision must always be smaller than the bytesize * BITS_PER_UNIT.
We don't have to do anything special to get this done -- an unset
- precision shows up as (unsigned int)-1, i.e. UINT_MAX. */
+ precision shows up as (unsigned int)-1, i.e. UINT_MAX.
+
+ If a mode is listed as no widen, sort it after the modes that are allowed as
+ widening types. This is for machine dependent floating point types that we
+ don't want to promotion. In particular on the PowerPC there are 2 different
+ 128-bit floating point types (IBM and IEEE) and there are values in each
+ type that can't be represented in the other type. */
static int
cmp_modes (const void *a, const void *b)
{
@@ -899,6 +905,11 @@ cmp_modes (const void *a, const void *b)
else if (m->precision < n->precision)
return -1;
+ if (!m->normal_widen && n->normal_widen)
+ return 1;
+ else if (m->normal_widen && !n->normal_widen)
+ return -1;
+
if (!m->component && !n->component)
{
if (m->counter < n->counter)
@@ -1547,18 +1558,19 @@ emit_mode_wider (void)
{
struct mode_data *m2 = 0;
- if (m->cl == MODE_INT
- || m->cl == MODE_PARTIAL_INT
- || m->cl == MODE_FLOAT
- || m->cl == MODE_DECIMAL_FLOAT
- || m->cl == MODE_COMPLEX_FLOAT
- || m->cl == MODE_FRACT
- || m->cl == MODE_UFRACT
- || m->cl == MODE_ACCUM
- || m->cl == MODE_UACCUM)
+ if (m->normal_widen
+ && (m->cl == MODE_INT
+ || m->cl == MODE_PARTIAL_INT
+ || m->cl == MODE_FLOAT
+ || m->cl == MODE_DECIMAL_FLOAT
+ || m->cl == MODE_COMPLEX_FLOAT
+ || m->cl == MODE_FRACT
+ || m->cl == MODE_UFRACT
+ || m->cl == MODE_ACCUM
+ || m->cl == MODE_UACCUM))
for (m2 = m->wider; m2 && m2 != void_mode; m2 = m2->wider)
{
- if (m2->no_widen)
+ if (!m2->normal_widen)
continue;
if (m2->bytesize == m->bytesize
&& m2->precision == m->precision)
@@ -1584,7 +1596,7 @@ emit_mode_wider (void)
m2 && m2 != void_mode;
m2 = m2->wider)
{
- if (m2->no_widen)
+ if (!m2->normal_widen)
continue;
if (m2->bytesize < 2 * m->bytesize)
continue;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-06 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 18:27 [gcc(refs/users/meissner/heads/work104)] Tweak last change Michael Meissner
-- strict thread matches above, loose matches on Subject: below --
2023-01-06 17:57 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).