From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 8F7CF3858C20; Fri, 6 Jan 2023 17:57:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F7CF3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673027851; bh=mXNPczxw59rSIA7TXZ1Xh5Wuwb5l1Ias0qjb69ctIt4=; h=From:To:Subject:Date:From; b=j75hBFjrQx51DISc1lQzwWK7+M+iZwGZOoWBzn0VrYJAtQBM+Xx6cqIlCXFnVyhNx pai+Gm2MJNpOhFxM0wDYvlS8lO2wBUk7rfmtg+SCHg+GpoZ9FUPCmTVajtOcpFpnRB 3E+bbHjy8z1KD8NfyN36Nx64kNW4z7CpVWf55x5w= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work104)] Tweak last change. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work104 X-Git-Oldrev: dbc15479d76aa68f37d5074e574a83125012b6db X-Git-Newrev: 0c997693e7479b552987dc62ffd36709659060c7 Message-Id: <20230106175731.8F7CF3858C20@sourceware.org> Date: Fri, 6 Jan 2023 17:57:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0c997693e7479b552987dc62ffd36709659060c7 commit 0c997693e7479b552987dc62ffd36709659060c7 Author: Michael Meissner Date: Fri Jan 6 12:57:02 2023 -0500 Tweak last change. 2022-01-06 Michael Meissner 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 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, "", 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;