public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>, Richard Biener <rguenther@suse.de>
Subject: Re: [PATCH 4/12] Middle-end _BitInt support [PR102989]
Date: Thu, 7 Sep 2023 10:36:02 +0200	[thread overview]
Message-ID: <87o7ietm6l.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <ZNPYTkXPz0ajFPdL@tucnak>

Hi Jakub!

On 2023-08-09T20:17:50+0200, Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> The following patch introduces the middle-end part of the _BitInt
> support, a new BITINT_TYPE, handling it where needed, except the lowering
> pass and sanitizer support.

Minor comment/question: are we doing away with the property that
'assert'-like "calls" must not have side effects?  Per 'gcc/system.h',
this is "OK" for 'gcc_assert' for '#if ENABLE_ASSERT_CHECKING' or
'#elif (GCC_VERSION >= 4005)' -- that is, GCC 4.5, which is always-true,
thus the "offending" '#else' is never active.  However, it's different
for standard 'assert' and 'gcc_checking_assert', so I'm not sure if
that's a good property for 'gcc_assert' only?  For example, see also
<https://gcc.gnu.org/PR6906> "warn about asserts with side effects", or
recent <https://gcc.gnu.org/PR111144>
"RFE: could -fanalyzer warn about assertions that have side effects?".

> --- gcc/expr.cc.jj    2023-08-08 16:02:52.837633995 +0200
> +++ gcc/expr.cc       2023-08-09 10:30:13.524295673 +0200

> @@ -11002,13 +11028,35 @@ expand_expr_real_1 (tree exp, rtx target

> +         struct bitint_info info;
> +         gcc_assert (targetm.c.bitint_type_info (prec, &info));
> +         scalar_int_mode limb_mode
> +           = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/fold-const.cc.jj      2023-08-08 15:55:06.507164442 +0200
> +++ gcc/fold-const.cc 2023-08-08 16:12:02.318939952 +0200

> @@ -7714,7 +7726,29 @@ static int

> +      struct bitint_info info;
> +      gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                           &info));
> +      scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> @@ -8622,7 +8656,29 @@ native_encode_initializer (tree init, un

> +      struct bitint_info info;
> +      gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                           &info));
> +      scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/gimple-fold.cc.jj     2023-08-08 15:55:06.609163014 +0200
> +++ gcc/gimple-fold.cc        2023-08-08 16:18:44.828303852 +0200

> +static bool
> +clear_padding_bitint_needs_padding_p (tree type)
> +{
> +  struct bitint_info info;
> +  gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +  if (info.extended)
> +    return false;

> @@ -4854,6 +4877,57 @@ clear_padding_type (clear_padding_struct

> +     struct bitint_info info;
> +     gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +     scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/stor-layout.cc.jj     2023-08-08 15:54:34.855607692 +0200
> +++ gcc/stor-layout.cc        2023-08-08 16:15:41.003877836 +0200

> @@ -2148,6 +2148,22 @@ finish_bitfield_representative (tree rep

> +       struct bitint_info info;
> +       unsigned prec = TYPE_PRECISION (TREE_TYPE (field));
> +       gcc_assert (targetm.c.bitint_type_info (prec, &info));
> +       scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> @@ -2393,6 +2409,64 @@ layout_type (tree type)

> +     struct bitint_info info;
> +     int cnt;
> +     gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +     scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/varasm.cc.jj  2023-08-08 15:54:35.517598423 +0200
> +++ gcc/varasm.cc     2023-08-08 16:12:02.330939784 +0200

> @@ -5281,6 +5281,61 @@ output_constant (tree exp, unsigned HOST

> +       struct bitint_info info;
> +       tree type = TREE_TYPE (exp);
> +       gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                               &info));
> +       scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  parent reply	other threads:[~2023-09-07  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 18:17 Jakub Jelinek
2023-08-22  8:41 ` Richard Biener
2023-09-07  8:36 ` Thomas Schwinge [this message]
2023-09-07  9:22   ` [committed] middle-end: Avoid calling targetm.c.bitint_type_info inside of gcc_assert [PR102989] Jakub Jelinek

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=87o7ietm6l.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).