From: Uros Bizjak <ubizjak@gmail.com>
To: Hongtao Liu <crazylht@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: Re: [PATCH]i386: Optimize pmovskb on zero_extend of subreg HI of the result [PR98461]
Date: Tue, 5 Jan 2021 11:30:13 +0100 [thread overview]
Message-ID: <CAFULd4YrfBMvExMzCvm5P1=wxGLLq=084qntsk14wJkJhEq3EQ@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bzXMikOw3YRZ7KMKspjrjvhDYyfEUzeaJwCGwbJ6+VVbg@mail.gmail.com>
On Tue, Jan 5, 2021 at 11:25 AM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Tue, Jan 5, 2021 at 3:20 PM Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> > On Tue, Jan 5, 2021 at 8:04 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> > > >
> > > > +(define_split
> > > > + [(set (match_operand:SI 0 "register_operand")
> > > > + (zero_extend:SI
> > > > + (not:HI
> > > > + (subreg:HI
> > > > + (unspec:SI
> > > > + [(match_operand:V16QI 1 "register_operand")]
> > > > + UNSPEC_MOVMSK) 0))))]
> > > > + "TARGET_SSE2"
> > > > + [(set (match_dup 2)
> > > > + (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK))
> > > > + (set (match_dup 0)
> > > > + (match_dup 3))]
> > >
> > > Just write:
> > >
> > > (set (match_dup 0)
> > > (xor:SI (match_dup 2)(const_int 65535))
> >
>
> Yes, changed.
>
> > BTW: This could be a universal combine splitter to simplify
> >
> > unsigned int foo (unsigned short z)
> > {
> > return (unsigned short)~z;
> > }
> >
> > Trying 7 -> 8:
> > 7: r87:HI=~r88:SI#0
> > REG_DEAD r88:SI
> > 8: r86:SI=zero_extend(r87:HI)
> > REG_DEAD r87:HI
> > Failed to match this instruction:
> > (set (reg:SI 86)
> > (zero_extend:SI (not:HI (subreg:HI (reg:SI 88) 0))))
> >
> > But combine does not "split" to one insns.
>
> Yes, according to PSabi, the top half of the register is not
> necessarily 0, so if you add the splitter, it just changes from notl +
> movzwl to xor + movzwl, which doesn't look better?
Indeed.
The patch is OK.
Uros.
prev parent reply other threads:[~2021-01-05 10:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-04 5:56 Hongtao Liu
2021-01-04 7:40 ` Uros Bizjak
2021-01-04 7:54 ` Hongtao Liu
2021-01-04 8:42 ` Uros Bizjak
2021-01-04 8:49 ` Jakub Jelinek
2021-01-04 8:59 ` Hongtao Liu
2021-01-05 6:32 ` Hongtao Liu
2021-01-05 7:04 ` Uros Bizjak
2021-01-05 7:19 ` Uros Bizjak
2021-01-05 10:28 ` Hongtao Liu
2021-01-05 10:30 ` Uros Bizjak [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='CAFULd4YrfBMvExMzCvm5P1=wxGLLq=084qntsk14wJkJhEq3EQ@mail.gmail.com' \
--to=ubizjak@gmail.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=kirill.yukhin@gmail.com \
/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).