From: Richard Sandiford <richard.sandiford@arm.com>
To: apinski--- via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: apinski@marvell.com
Subject: Re: [PATCH] Fix PR target/103100 -mstrict-align and memset on not aligned buffers
Date: Wed, 17 Nov 2021 09:38:19 +0000 [thread overview]
Message-ID: <mptzgq36s1g.fsf@arm.com> (raw)
In-Reply-To: <1636176325-17121-1-git-send-email-apinski@marvell.com> (apinski's message of "Fri, 5 Nov 2021 22:25:25 -0700")
apinski--- via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> From: Andrew Pinski <apinski@marvell.com>
>
> The problem here is with -mstrict-align, aarch64_expand_setmem needs
> to check the alginment of the mode to make sure we can use it for
> doing the stores.
>
> gcc/ChangeLog:
>
> PR target/103100
> * config/aarch64/aarch64.c (aarch64_expand_setmem):
> Add check for alignment of the mode if STRICT_ALIGNMENT is true.
> ---
> gcc/config/aarch64/aarch64.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index fdf05505846..2c00583e12c 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -23738,7 +23738,9 @@ aarch64_expand_setmem (rtx *operands)
> over writing. */
> opt_scalar_int_mode mode_iter;
> FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT)
> - if (GET_MODE_BITSIZE (mode_iter.require ()) <= MIN (n, copy_limit))
> + if (GET_MODE_BITSIZE (mode_iter.require ()) <= MIN (n, copy_limit)
> + && (!STRICT_ALIGNMENT
> + || MEM_ALIGN (dst) >= GET_MODE_ALIGNMENT (mode_iter.require ())))
Sorry for the slow review. I think instead we should have keep
track of the alignment of the start byte. This will be MEM_ALIGN
for the first iteration but could decrease after writing some bytes.
The net effect should be the same in practice. It just seems
more robust.
Thanks,
Richard
> cur_mode = mode_iter.require ();
>
> gcc_assert (cur_mode != BLKmode);
next prev parent reply other threads:[~2021-11-17 9:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 5:25 apinski
2021-11-17 9:38 ` Richard Sandiford [this message]
2021-11-18 6:35 ` Andrew Pinski
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=mptzgq36s1g.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@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: 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).