public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/116004] New: PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code
@ 2024-07-19 14:59 munroesj at gcc dot gnu.org
2024-07-19 15:18 ` [Bug target/116004] " munroesj at gcc dot gnu.org
2024-07-19 21:28 ` munroesj at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: munroesj at gcc dot gnu.org @ 2024-07-19 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116004
Bug ID: 116004
Summary: PPC64 vector Intrinsic vec_first_mismatch_or_eos_index
generates poor code
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: munroesj at gcc dot gnu.org
Target Milestone: ---
GCC13 generates the following code for the intrinsic
vec_first_mismatch_or_eos_index -mcpu=power9 -O3:
00000000000000c0 <test_intrn_first_mismatch_or_eos_index_PWR9>:
c0: d1 02 00 f0 xxspltib vs32,0
c4: 07 00 22 10 vcmpneb v1,v2,v0
c8: 07 00 03 10 vcmpneb v0,v3,v0
cc: 07 19 42 10 vcmpnezb v2,v2,v3
d0: 17 04 21 f0 xxland vs33,vs33,vs32
d4: 57 0d 42 f0 xxlorc vs34,vs34,vs33
d8: 02 16 61 10 vctzlsbb r3,v2
dc: b4 07 63 7c extsw r3,r3
e0: 20 00 80 4e blr
The use of vcmpneb to compare for EOS is redundant to the vcmpnezb instruction
(which includes the EOS compares). The additional xxland/xxorc logic is only
necessary because of the extra vcmpneb compares.
All you need is a single vcmpnezb as it already handles the a/b mismatch and
EOS tests for both operands. For example:
0000000000000070 <test_vec_first_mismatch_byte_or_eos_index>:
70: 07 19 42 10 vcmpnezb v2,v2,v3
74: 02 16 61 10 vctzlsbb r3,v2
78: b4 07 63 7c extsw r3,r3
7c: 20 00 80 4e blr
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/116004] PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code
2024-07-19 14:59 [Bug c/116004] New: PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code munroesj at gcc dot gnu.org
@ 2024-07-19 15:18 ` munroesj at gcc dot gnu.org
2024-07-19 21:28 ` munroesj at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: munroesj at gcc dot gnu.org @ 2024-07-19 15:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116004
--- Comment #1 from Steven Munroe <munroesj at gcc dot gnu.org> ---
Compile test code examples:
int
test_intrn_first_mismatch_or_eos_index_PWR9 (vui8_t vra, vui8_t vrb)
{
return vec_first_mismatch_or_eos_index (vra, vrb);
}
int
test_first_mismatch_byte_or_eos_index_PWR9 (vui8_t vra, vui8_t vrb)
{
vui8_t abnez;
int result;
abnez = vec_cmpnez (vra, vrb);
result = vec_cntlz_lsbb (abnez);
return result;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/116004] PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code
2024-07-19 14:59 [Bug c/116004] New: PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code munroesj at gcc dot gnu.org
2024-07-19 15:18 ` [Bug target/116004] " munroesj at gcc dot gnu.org
@ 2024-07-19 21:28 ` munroesj at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: munroesj at gcc dot gnu.org @ 2024-07-19 21:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116004
--- Comment #2 from Steven Munroe <munroesj at gcc dot gnu.org> ---
Actually:
abnez = (vui8_t) vec_cmpnez (vra, vrb);
result = vec_cntlz_lsbb (abnez);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-19 21:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-19 14:59 [Bug c/116004] New: PPC64 vector Intrinsic vec_first_mismatch_or_eos_index generates poor code munroesj at gcc dot gnu.org
2024-07-19 15:18 ` [Bug target/116004] " munroesj at gcc dot gnu.org
2024-07-19 21:28 ` munroesj at gcc dot gnu.org
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).