public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-9108] dse: Cope with bigger-than-integer modes [PR98037] Date: Wed, 2 Dec 2020 16:21:25 +0000 (GMT) [thread overview] Message-ID: <20201202162125.AE0CC395C401@sourceware.org> (raw) https://gcc.gnu.org/g:fb9ee3e7419178e6530c09b99272022d062b50f3 commit r10-9108-gfb9ee3e7419178e6530c09b99272022d062b50f3 Author: Richard Sandiford <richard.sandiford@arm.com> Date: Wed Dec 2 16:20:34 2020 +0000 dse: Cope with bigger-than-integer modes [PR98037] dse.c:find_shift_sequence tries to represent a store and load back as a shift right followed by a truncation. It therefore needs to find an integer mode in which to do the shift right. The loop it uses has the form: FOR_EACH_MODE_FROM (new_mode_iter, smallest_int_mode_for_size (GET_MODE_BITSIZE (read_mode))) which implicitly assumes that read_mode has an equivalent integer mode. As shown in the testcase, not all modes have such an integer mode. This patch just makes the code start from the smallest integer mode and skip modes that are too small. The loop already breaks at the first mode wider than word_mode. gcc/ PR rtl-optimization/98037 * dse.c (find_shift_sequence): Iterate over all integers and skip modes that are too small. gcc/testsuite/ PR rtl-optimization/98037 * gcc.target/aarch64/sve/acle/general/pr98037.c: New test. (cherry picked from commit f835e9f6562dda9c8a1384be2c9d4e45c112ed8e) Diff: --- gcc/dse.c | 5 +++-- gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr98037.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/dse.c b/gcc/dse.c index bbe792e48e8..c8dcf46ed29 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1728,8 +1728,7 @@ find_shift_sequence (poly_int64 access_size, the machine. */ opt_scalar_int_mode new_mode_iter; - FOR_EACH_MODE_FROM (new_mode_iter, - smallest_int_mode_for_size (access_size * BITS_PER_UNIT)) + FOR_EACH_MODE_IN_CLASS (new_mode_iter, MODE_INT) { rtx target, new_reg, new_lhs; rtx_insn *shift_seq, *insn; @@ -1738,6 +1737,8 @@ find_shift_sequence (poly_int64 access_size, new_mode = new_mode_iter.require (); if (GET_MODE_BITSIZE (new_mode) > BITS_PER_WORD) break; + if (maybe_lt (GET_MODE_SIZE (new_mode), access_size)) + continue; /* If a constant was stored into memory, try to simplify it here, otherwise the cost of the shift might preclude this optimization diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr98037.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr98037.c new file mode 100644 index 00000000000..b91e940b18e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr98037.c @@ -0,0 +1,6 @@ +/* { dg-options "-msve-vector-bits=1024 -O3" } */ + +typedef __SVInt8_t vec __attribute__((arm_sve_vector_bits(1024))); +struct pair { vec v[2]; }; +void use (struct pair *); +vec f (struct pair p) { vec v = p.v[1]; use (&p); return v; }
reply other threads:[~2020-12-02 16:21 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=20201202162125.AE0CC395C401@sourceware.org \ --to=rsandifo@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).