From: HAO CHEN GUI <guihaoc@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>, richard.sandiford@arm.com
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
David <dje.gcc@gmail.com>, Peter Bergner <bergner@linux.ibm.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
Jeff Law <jlaw@ventanamicro.com>,
Jakub Jelinek <jakub@redhat.com>,
Richard Biener <richard.guenther@gmail.com>
Subject: Re: [PATCH, rs6000] Enable vector compare for 16-byte memory equality compare [PR111449]
Date: Thu, 28 Sep 2023 16:10:14 +0800 [thread overview]
Message-ID: <f2b5309c-2673-0860-ce73-44c67e531ae3@linux.ibm.com> (raw)
In-Reply-To: <mptv8bvub1y.fsf@arm.com>
Kewen and Richard,
Thanks for your comments. Please let me clarify it.
在 2023/9/27 19:10, Richard Sandiford 写道:
> Yeah, I agree there doesn't seem to be a good reason to exclude vectors.
> Sorry to dive straight into details, but maybe we should have something
> called bitwise_mode_for_size that tries to use integer modes where possible,
> but falls back to vector modes otherwise. That mode could then be used
> for copying, storing, bitwise ops, and equality comparisons (if there
> is appropriate optabs support).
The vector mode is not supported for compare_by_pieces and move_by_pieces.
But it is supported for set_by_pieces and clear_by_pieces. The help function
widest_fixed_size_mode_for_size returns vector mode when qi_vector is set to
true.
static fixed_size_mode
widest_fixed_size_mode_for_size (unsigned int size, bool qi_vector)
I tried to enable qi_vector for compare_by_pieces. It can pick up a vector
mode (eg. V16QImode) and works on some cases. But it fails on a constant
string case.
int compare (const char* s1)
{
return __builtin_memcmp_eq (s1, "__GCC_HAVE_DWARF2_CFI_ASM", 16);
}
As the second op is a constant string, it calls builtin_memcpy_read_str to
build the string. Unfortunately, the inner function doesn't support
vector mode.
/* The by-pieces infrastructure does not try to pick a vector mode
for memcpy expansion. */
return c_readstr (rep + offset, as_a <scalar_int_mode> (mode),
/*nul_terminated=*/false);
Seems by-pieces infrastructure itself supports vector mode, but low level
functions do not.
I think there are two ways enable vector mode for compare_by_pieces.
One is to modify the by-pieces infrastructure . Another is to enable it
by cmpmem expand. The expand is target specific and be flexible.
What's your opinion?
Thanks
Gui Haochen
next prev parent reply other threads:[~2023-09-28 8:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 8:49 HAO CHEN GUI
2023-09-25 6:09 ` Kewen.Lin
2023-09-27 11:10 ` Richard Sandiford
2023-09-28 8:10 ` HAO CHEN GUI [this message]
2023-09-28 13:39 ` Richard Sandiford
2023-09-29 7:51 ` HAO CHEN GUI
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=f2b5309c-2673-0860-ce73-44c67e531ae3@linux.ibm.com \
--to=guihaoc@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jlaw@ventanamicro.com \
--cc=linkw@linux.ibm.com \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.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).