public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8650] lower-bitint: Fix up VIEW_CONVERT_EXPR handling in handle_operand_addr [PR113639] Date: Wed, 31 Jan 2024 09:55:50 +0000 (GMT) [thread overview] Message-ID: <20240131095550.0DA3A386D634@sourceware.org> (raw) https://gcc.gnu.org/g:90ac839a470d61ffcd9eee0d7d37ca9c385dfefb commit r14-8650-g90ac839a470d61ffcd9eee0d7d37ca9c385dfefb Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Jan 31 10:50:33 2024 +0100 lower-bitint: Fix up VIEW_CONVERT_EXPR handling in handle_operand_addr [PR113639] Yet another spot where we need to treat VIEW_CONVERT_EXPR differently from NOP_EXPR/CONVERT_EXPR. 2024-01-31 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113639 * gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr): For VIEW_CONVERT_EXPR set rhs1 to its operand. * gcc.dg/bitint-79.c: New test. Diff: --- gcc/gimple-lower-bitint.cc | 2 ++ gcc/testsuite/gcc.dg/bitint-79.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index af167450ec05..a3802c61816a 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -2159,6 +2159,8 @@ bitint_large_huge::handle_operand_addr (tree op, gimple *stmt, gcc_assert (gimple_assign_cast_p (g)); tree rhs1 = gimple_assign_rhs1 (g); bitint_prec_kind kind = bitint_prec_small; + if (TREE_CODE (rhs1) == VIEW_CONVERT_EXPR) + rhs1 = TREE_OPERAND (rhs1, 0); gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))); if (TREE_CODE (TREE_TYPE (rhs1)) == BITINT_TYPE) kind = bitint_precision_kind (TREE_TYPE (rhs1)); diff --git a/gcc/testsuite/gcc.dg/bitint-79.c b/gcc/testsuite/gcc.dg/bitint-79.c new file mode 100644 index 000000000000..e7422c06acf7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-79.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/113639 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2 -std=c23" } */ + +int j, k; +#if __BITINT_MAXWIDTH__ >= 162 +struct S { _BitInt(162) n; }; +void bar (_BitInt(162) x); + +void +foo (struct S s) +{ + bar (s.n * j); + (void) (s.n * k); +} +#endif
reply other threads:[~2024-01-31 9:55 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=20240131095550.0DA3A386D634@sourceware.org \ --to=jakub@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: linkBe 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).