From: Hongtao Liu <crazylht@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: [PATCH] Optimize comparison between result of us_minus and 0.
Date: Thu, 3 Sep 2020 17:39:50 +0800 [thread overview]
Message-ID: <CAMZc-bx+b=xhovUR4vgG11Vu0FR1GiBxFj_c5quCzqaKV3raYg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
Hi:
Add define_peephole2 to perform optimization like bellow:
+/* Optimize for TARGET_AVX512F
+ vpsubusw op1, op2, dst1;
+ vxorps xmm, xmm, dst2; ----> vpcmpleuw op1, op2, dst3
+ vpcmpeqw dst1, dst2, dst3 */
and
+/* Optimize for target above TARGET_SSE4_1
+ vpsubusw op1, op2, dst1; vpminuw op1, op2, dst1
+ vpxor xmm, xmm, dst2; ----> vpcmpeqw op1, dst1, dst3
+ vpcmpeqw dst1, dst2, dst3 */
Bootstrap is ok, regression test is ok for i386/x86-64 backend.
Ok for trunk?
gcc/ChangeLog:
PR target/96906
* config/i386/sse.md (VI12_128_256): New mode iterator.
(define_peephole2): Optimize comparison between result of
us_minus and 0, it could be optimized to "vpcmplequ" for
AVX512 or "pminu + cmpeq" for target above TARGET_SSE4_1.
gcc/testsuite/ChangeLog:
* gcc.target/i386/avx2-pr96906-1.c: New test.
* gcc.target/i386/avx512f-pr96906-1.c: New test.
* gcc.target/i386/sse2-pr96906.c: New test.
* gcc.target/i386/sse4_1-pr96906-1.c: New test.
--
BR,
Hongtao
[-- Attachment #2: 0001-Optimize-__builtin_ia32_psubusw128-compared-to-0-to-.patch --]
[-- Type: application/x-patch, Size: 7850 bytes --]
next reply other threads:[~2020-09-03 9:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 9:39 Hongtao Liu [this message]
2020-11-17 0:08 ` Jeff Law
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-bx+b=xhovUR4vgG11Vu0FR1GiBxFj_c5quCzqaKV3raYg@mail.gmail.com' \
--to=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--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).