From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] bitint: Handle VCE from large/huge _BitInt SSA_NAME from load [PR114156]
Date: Fri, 1 Mar 2024 09:11:05 +0100 [thread overview]
Message-ID: <ZeGNmWQjnrlektiI@tucnak> (raw)
Hi!
When adding checks in which case not to merge a VIEW_CONVERT_EXPR from
large/huge _BitInt to vector/complex etc., I missed the case of loads.
Those are handled differently later.
Anyway, I think the load case is something we can handle just fine,
so the following patch does that instead of preventing the merging
gimple_lower_bitint; we'd then copy from memory to memory and and do the
vce only on the second one, it is just better to vce the first one.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2024-03-01 Jakub Jelinek <jakub@redhat.com>
PR middle-end/114156
* gimple-lower-bitint.cc (bitint_large_huge::lower_stmt): Allow
rhs1 of a VCE to have no underlying variable if it is a load and
handle that case.
* gcc.dg/bitint-96.c: New test.
--- gcc/gimple-lower-bitint.cc.jj 2024-02-24 12:44:27.993108306 +0100
+++ gcc/gimple-lower-bitint.cc 2024-02-29 19:28:59.442020619 +0100
@@ -5329,6 +5329,22 @@ bitint_large_huge::lower_stmt (gimple *s
gimple_assign_set_rhs1 (stmt, rhs1);
gimple_assign_set_rhs_code (stmt, SSA_NAME);
}
+ else if (m_names == NULL
+ || !bitmap_bit_p (m_names, SSA_NAME_VERSION (rhs1)))
+ {
+ gimple *g = SSA_NAME_DEF_STMT (rhs1);
+ gcc_assert (gimple_assign_load_p (g));
+ tree mem = gimple_assign_rhs1 (g);
+ tree ltype = TREE_TYPE (lhs);
+ addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (mem));
+ if (as != TYPE_ADDR_SPACE (ltype))
+ ltype
+ = build_qualified_type (ltype,
+ TYPE_QUALS (ltype)
+ | ENCODE_QUAL_ADDR_SPACE (as));
+ rhs1 = build1 (VIEW_CONVERT_EXPR, ltype, mem);
+ gimple_assign_set_rhs1 (stmt, rhs1);
+ }
else
{
int part = var_to_partition (m_map, rhs1);
--- gcc/testsuite/gcc.dg/bitint-96.c.jj 2024-02-29 19:37:27.441032088 +0100
+++ gcc/testsuite/gcc.dg/bitint-96.c 2024-02-29 19:36:34.815753879 +0100
@@ -0,0 +1,17 @@
+/* PR middle-end/114156 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target i?86-*-* x86_64-*-* } } */
+
+#if __BITINT_MAXWIDTH__ >= 128
+_BitInt(128) a, b;
+#else
+int a, b;
+#endif
+
+void
+foo (void)
+{
+ int u = b;
+ __builtin_memmove (&a, &b, sizeof (a));
+}
Jakub
next reply other threads:[~2024-03-01 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 8:11 Jakub Jelinek [this message]
2024-03-01 9:46 ` Richard Biener
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=ZeGNmWQjnrlektiI@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--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).