public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4694] tree-optimization/107617 - big-endian .LEN_STORE VN Date: Wed, 14 Dec 2022 07:48:57 +0000 (GMT) [thread overview] Message-ID: <20221214074857.B095338358A2@sourceware.org> (raw) https://gcc.gnu.org/g:d3fee43fb3873b00de913e0501fbf28b56d2ce64 commit r13-4694-gd3fee43fb3873b00de913e0501fbf28b56d2ce64 Author: Richard Biener <rguenther@suse.de> Date: Mon Nov 28 12:38:46 2022 +0100 tree-optimization/107617 - big-endian .LEN_STORE VN The following fixes a mistake in interpreting .LEN_STORE definitions during value-numbering when in big-endian mode. We cannot offset the encoding of the RHS but instead encode to an offsetted position which is then treated correctly by the endian aware copying code. PR tree-optimization/107617 * tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def): Handle negative pd.rhs_off. (vn_reference_lookup_3): Properly provide pd.rhs_off for .LEN_STORE on big-endian targets. Diff: --- gcc/tree-ssa-sccvn.cc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index b9f289b6eca..fa2f65df159 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -2090,7 +2090,7 @@ vn_walk_cb_data::push_partial_def (pd_data pd, len = ROUND_UP (pd.size, BITS_PER_UNIT) / BITS_PER_UNIT; memset (this_buffer, 0, len); } - else + else if (pd.rhs_off >= 0) { len = native_encode_expr (pd.rhs, this_buffer, bufsize, (MAX (0, -pd.offset) @@ -2105,6 +2105,24 @@ vn_walk_cb_data::push_partial_def (pd_data pd, return (void *)-1; } } + else /* negative pd.rhs_off indicates we want to chop off first bits */ + { + if (-pd.rhs_off >= bufsize) + return (void *)-1; + len = native_encode_expr (pd.rhs, + this_buffer + -pd.rhs_off / BITS_PER_UNIT, + bufsize - -pd.rhs_off / BITS_PER_UNIT, + MAX (0, -pd.offset) / BITS_PER_UNIT); + if (len <= 0 + || len < (ROUND_UP (pd.size, BITS_PER_UNIT) / BITS_PER_UNIT + - MAX (0, -pd.offset) / BITS_PER_UNIT)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Failed to encode %u " + "partial definitions\n", ndefs); + return (void *)-1; + } + } unsigned char *p = buffer; HOST_WIDE_INT size = pd.size; @@ -3349,10 +3367,13 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, } else if (fn == IFN_LEN_STORE) { - pd.rhs_off = 0; pd.offset = offset2i; pd.size = (tree_to_uhwi (len) + -tree_to_shwi (bias)) * BITS_PER_UNIT; + if (BYTES_BIG_ENDIAN) + pd.rhs_off = pd.size - tree_to_uhwi (TYPE_SIZE (vectype)); + else + pd.rhs_off = 0; if (ranges_known_overlap_p (offset, maxsize, pd.offset, pd.size)) return data->push_partial_def (pd, set, set,
reply other threads:[~2022-12-14 7:48 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=20221214074857.B095338358A2@sourceware.org \ --to=rguenth@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).