public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105072] New: Miss optimization for pmovzxbq.
@ 2022-03-28  3:50 crazylht at gmail dot com
  2022-03-28 14:42 ` [Bug target/105072] " crazylht at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2022-03-28  3:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105072

            Bug ID: 105072
           Summary: Miss optimization for pmovzxbq.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

This is quoted from PR105066:

It's also essential that these loads fold efficiently into memory source
operands for PMOVZX; pmovzxbq is one of the major use-cases for a 16-bit load.

That may be a separate bug, IDK

https://godbolt.org/z/3a9T55n3q shows _mm_cvtepu8_epi32(_mm_loadu_si32(p)) does
fold a 32-bit memory source operand nicely to pmovzxbd (%rdi), %xmm0 which can
micro-fuse into a single uop on Intel CPUs (for the 128-bit destination
version, not YMM), but disaster with 16-bit loads:

__m128i pmovzxbq(void *p){
    return _mm_cvtepu8_epi64(_mm_loadu_si16(p));
}

pmovzxbq(void*):  # -O3 -msse4.1 -mtune=haswell
        pxor    %xmm0, %xmm0                  # 1 uop
        pinsrw  $0, (%rdi), %xmm0             # 2 uops, one for shuffle port
        pmovzxbq        %xmm0, %xmm0          # 1 uop for the same shuffle port
        ret

(_mm_cvtepu8_epi64 requires SSE4.1 so there's no interaction with the
-mno-sse4.1 implementation of the load.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105072] Miss optimization for pmovzxbq.
  2022-03-28  3:50 [Bug target/105072] New: Miss optimization for pmovzxbq crazylht at gmail dot com
@ 2022-03-28 14:42 ` crazylht at gmail dot com
  2022-05-09 10:59 ` cvs-commit at gcc dot gnu.org
  2022-05-09 11:01 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2022-03-28 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105072

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
Created attachment 52699
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52699&action=edit
Patch pending for GCC13

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105072] Miss optimization for pmovzxbq.
  2022-03-28  3:50 [Bug target/105072] New: Miss optimization for pmovzxbq crazylht at gmail dot com
  2022-03-28 14:42 ` [Bug target/105072] " crazylht at gmail dot com
@ 2022-05-09 10:59 ` cvs-commit at gcc dot gnu.org
  2022-05-09 11:01 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-09 10:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105072

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:8b59556e1c72c7c3654a7d7c675832d9fd38b7a0

commit r13-203-g8b59556e1c72c7c3654a7d7c675832d9fd38b7a0
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Mar 28 15:31:53 2022 +0800

    Optimize vec_setv8{hi,hf}_0 + pmovzxbq to pmovzxbq.

    gcc/ChangeLog:

            PR target/105072
            * config/i386/sse.md (*sse4_1_<code>v2qiv2di2<mask_name>_1):
            New define_insn.
            (*sse4_1_zero_extendv2qiv2di2_2): New pre_reload
            define_insn_and_split.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr105072.c: New test.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/105072] Miss optimization for pmovzxbq.
  2022-03-28  3:50 [Bug target/105072] New: Miss optimization for pmovzxbq crazylht at gmail dot com
  2022-03-28 14:42 ` [Bug target/105072] " crazylht at gmail dot com
  2022-05-09 10:59 ` cvs-commit at gcc dot gnu.org
@ 2022-05-09 11:01 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2022-05-09 11:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105072

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC13.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-09 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28  3:50 [Bug target/105072] New: Miss optimization for pmovzxbq crazylht at gmail dot com
2022-03-28 14:42 ` [Bug target/105072] " crazylht at gmail dot com
2022-05-09 10:59 ` cvs-commit at gcc dot gnu.org
2022-05-09 11:01 ` crazylht at gmail dot com

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).