From: Kito Cheng <kito.cheng@gmail.com>
To: Christoph Muellner <cmuellner@gcc.gnu.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Andrew Waterman <andrew@sifive.com>
Subject: Re: [PATCH] RISC-V: Allow unaligned accesses in cpymemsi expansion
Date: Mon, 16 Aug 2021 17:55:03 +0800 [thread overview]
Message-ID: <CA+yXCZCyC9tqEEwQoF6Y6CkMM7sG1jj2wdVHQqOGNprJPs7HiA@mail.gmail.com> (raw)
In-Reply-To: <20210729143356.3580069-1-cmuellner@gcc.gnu.org>
Hi Christoph:
Generally LGTM, only 1 minor comment.
> @@ -3292,8 +3294,17 @@ riscv_expand_block_move (rtx dest, rtx src, rtx length)
> unsigned HOST_WIDE_INT hwi_length = UINTVAL (length);
> unsigned HOST_WIDE_INT factor, align;
>
> - align = MIN (MIN (MEM_ALIGN (src), MEM_ALIGN (dest)), BITS_PER_WORD);
> - factor = BITS_PER_WORD / align;
> + if (riscv_slow_unaligned_access_p)
> + {
> + align = MIN (MIN (MEM_ALIGN (src), MEM_ALIGN (dest)), BITS_PER_WORD);
> + factor = BITS_PER_WORD / align;
> + }
> + else
> + {
> + /* Assume data to be aligned. */
> + align = hwi_length * BITS_PER_UNIT;
Either the variable should be renamed or just set to BITS_PER_WORD?
e.g hwi_length = 15, then align =15 * 8 = 120
Although that still generated the result since mode_for_size still
returns DI for rv64 and SI for rv32.
> + factor = 1;
I would prefer keep factor = BITS_PER_WORD / align; and then pull it
outside like that:
```c
if (riscv_slow_unaligned_access_p)
align = MIN (MIN (MEM_ALIGN (src), MEM_ALIGN (dest)), BITS_PER_WORD);
else
align = BITS_PER_WORD;
factor = BITS_PER_WORD / align;
```
prev parent reply other threads:[~2021-08-16 9:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 14:33 Christoph Muellner
2021-08-05 9:11 ` Christoph Müllner
2021-08-13 17:52 ` Christoph Müllner
2021-08-16 9:55 ` Kito Cheng [this message]
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=CA+yXCZCyC9tqEEwQoF6Y6CkMM7sG1jj2wdVHQqOGNprJPs7HiA@mail.gmail.com \
--to=kito.cheng@gmail.com \
--cc=andrew@sifive.com \
--cc=cmuellner@gcc.gnu.org \
--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).