public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/101956] New: Miss vectorization from v4hi to v4df
@ 2021-08-18  6:00 crazylht at gmail dot com
  2021-08-18  6:11 ` [Bug target/101956] " crazylht at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: crazylht at gmail dot com @ 2021-08-18  6:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101956
           Summary: Miss vectorization from v4hi to v4df
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-*-* i?86-*-*

void
foo (double* p, short* q)
{
   p[0] = q[0];
   p[1] = q[1];
   p[2] = q[2];
   p[3] = q[3];
}

clang generates 

        vpmovsxwd       xmm0, qword ptr [rsi]
        vcvtdq2pd       ymm0, xmm0
        vmovups ymmword ptr [rdi], ymm0
        vzeroupper

gcc generates

foo(double*, short*):
  movswl (%rsi), %eax
  vxorps %xmm0, %xmm0, %xmm0
  vcvtsi2sdl %eax, %xmm0, %xmm1
  movswl 2(%rsi), %eax
  vcvtsi2sdl %eax, %xmm0, %xmm2
  movswl 4(%rsi), %eax
  vmovsd %xmm2, %xmm2, %xmm3
  vcvtsi2sdl %eax, %xmm0, %xmm2
  movswl 6(%rsi), %eax
  vcvtsi2sdl %eax, %xmm0, %xmm0
  vunpcklpd %xmm0, %xmm2, %xmm2
  vunpcklpd %xmm3, %xmm1, %xmm0
  vinsertf128 $0x1, %xmm2, %ymm0, %ymm0
  vmovupd %ymm0, (%rdi)
  vzeroupper
  ret

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

* [Bug target/101956] Miss vectorization from v4hi to v4df
  2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
@ 2021-08-18  6:11 ` crazylht at gmail dot com
  2021-08-18  6:49 ` crazylht at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: crazylht at gmail dot com @ 2021-08-18  6:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
test4.c:4:9: missed:   conversion not supported by target.

SLP expect {zero_,}extendv4hiv4df?

loop vectorizer can automatically try extendv8hiv8si + extendv4siv4df
void
foo1 (double* p, short* q, int n)
{
    for (int i = 0; i != n; i++)
      p[i] = q[i];
}

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

* [Bug target/101956] Miss vectorization from v4hi to v4df
  2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
  2021-08-18  6:11 ` [Bug target/101956] " crazylht at gmail dot com
@ 2021-08-18  6:49 ` crazylht at gmail dot com
  2021-08-18  6:54 ` [Bug tree-optimization/101956] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: crazylht at gmail dot com @ 2021-08-18  6:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---


(In reply to Hongtao.liu from comment #1)
> test4.c:4:9: missed:   conversion not supported by target.
> 
> SLP expect {zero_,}extendv4hiv4df?
Typo floatv4hiv4df
> 
> loop vectorizer can automatically try extendv8hiv8si + extendv4siv4df
and floatv4siv4df here.
> void
> foo1 (double* p, short* q, int n)
> {
>     for (int i = 0; i != n; i++)
>       p[i] = q[i];
> }

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

* [Bug tree-optimization/101956] Miss vectorization from v4hi to v4df
  2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
  2021-08-18  6:11 ` [Bug target/101956] " crazylht at gmail dot com
  2021-08-18  6:49 ` crazylht at gmail dot com
@ 2021-08-18  6:54 ` rguenth at gcc dot gnu.org
  2022-03-07 21:42 ` pinskia at gcc dot gnu.org
  2023-11-01  3:35 ` crazylht at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-18  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
          Component|target                      |tree-optimization
   Last reconfirmed|                            |2021-08-18
             Blocks|                            |53947
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
vectorizable_conversion only checks

    case NONE:
      if (code != FIX_TRUNC_EXPR
          && code != FLOAT_EXPR
          && !CONVERT_EXPR_CODE_P (code))
        return false;
      if (supportable_convert_operation (code, vectype_out, vectype_in,
&code1))
        break;
      /* FALLTHRU */
    unsupported:
      if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "conversion not supported by target.\n");
      return false;

compared to WIDEN/NARROW which supoort multi-step conversions.  It shouldn't be
too difficult to teach the NONE case to do this (are there any conversion
instructions that do more than 2x widen/narrow?)

IMHO this should be addressed at the vectorizer level.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

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

* [Bug tree-optimization/101956] Miss vectorization from v4hi to v4df
  2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-18  6:54 ` [Bug tree-optimization/101956] " rguenth at gcc dot gnu.org
@ 2022-03-07 21:42 ` pinskia at gcc dot gnu.org
  2023-11-01  3:35 ` crazylht at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-03-07 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug tree-optimization/101956] Miss vectorization from v4hi to v4df
  2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
                   ` (3 preceding siblings ...)
  2022-03-07 21:42 ` pinskia at gcc dot gnu.org
@ 2023-11-01  3:35 ` crazylht at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: crazylht at gmail dot com @ 2023-11-01  3:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed by r14-2007-g6f19cf7526168f

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

end of thread, other threads:[~2023-11-01  3:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18  6:00 [Bug target/101956] New: Miss vectorization from v4hi to v4df crazylht at gmail dot com
2021-08-18  6:11 ` [Bug target/101956] " crazylht at gmail dot com
2021-08-18  6:49 ` crazylht at gmail dot com
2021-08-18  6:54 ` [Bug tree-optimization/101956] " rguenth at gcc dot gnu.org
2022-03-07 21:42 ` pinskia at gcc dot gnu.org
2023-11-01  3:35 ` 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).