From: Hongtao Liu <crazylht@gmail.com>
To: i.nixman@autistici.org
Cc: gcc-help@gcc.gnu.org
Subject: Re: simd, redundant pcmpeqb and pxor
Date: Mon, 7 Nov 2022 14:32:55 +0800 [thread overview]
Message-ID: <CAMZc-byahv0uJbaz_Ng4VsThScaFO+zRx-22kWS_xbWMOGcc0A@mail.gmail.com> (raw)
In-Reply-To: <71218c0c63bfa161f9f828cbf312debe@autistici.org>
On Mon, Nov 7, 2022 at 2:26 PM <i.nixman@autistici.org> wrote:
>
> On 2022-11-07 03:32, Hongtao Liu wrote:
> > On Sun, Nov 6, 2022 at 6:54 PM i.nixman--- via Gcc-help
> > <gcc-help@gcc.gnu.org> wrote:
> >>
> >>
> >> Hello,
> >>
> >> look at this example(https://godbolt.org/z/TnGMsfMs6):
> >> ```
> >> auto foo(const char *p) {
> >> const auto substr = _mm_loadu_si128((const __m128i *)p);
> >> return _mm_cmplt_epi8(substr, _mm_set1_epi8('0'));
> >> }
> >> ```
> >> and to the generated asm:
> >> ```
> >> 1: foo(char const*):
> >> 2: movdqu xmm0, XMMWORD PTR [rdi]
> >> 3: pxor xmm1, xmm1
> >> 4: pcmpgtb xmm0, XMMWORD PTR .LC0[rip]
> >> 5: pcmpeqb xmm0, xmm1
> >> 6: ret
> >> ```
> >> look at line 5.
> >> is there any reason for `pcmpeqb` instruction?
>
> hi,
>
> > Looks like a mis optimization from
> >
> > _4 = VIEW_CONVERT_EXPR<__v16qs>(_7);
> > _3 = _4 <= { 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
> > 47, 47 };
> > _5 = VIEW_CONVERT_EXPR<vector(16) signed char>(_3); --- this?
> >
> > Could you open a bugzilla for it
> > https://gcc.gnu.org/bugzilla/
>
> sure, but for which component?
Let's put it as rtl-optimization first.
>
>
>
> >>
> >> just for info, clang's output(https://godbolt.org/z/MPnvEMdhr):
> >> ```
> >> 1: foo(char const*):
> >> 2: movdqu xmm1, xmmword ptr [rdi]
> >> 3: movdqa xmm0, xmmword ptr [rip + .LCPI0_0]
> >> 4: pcmpgtb xmm0, xmm1
> >> 5: ret
> >> ```
> >>
> >>
> >> best!
--
BR,
Hongtao
next prev parent reply other threads:[~2022-11-07 6:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-06 10:53 i.nixman
2022-11-07 3:32 ` Hongtao Liu
2022-11-07 6:26 ` i.nixman
2022-11-07 6:32 ` Hongtao Liu [this message]
2022-11-07 6:40 ` i.nixman
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=CAMZc-byahv0uJbaz_Ng4VsThScaFO+zRx-22kWS_xbWMOGcc0A@mail.gmail.com \
--to=crazylht@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=i.nixman@autistici.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).