public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102758] New: [x86] Failure to use registers optimally when swapping between (identically represented) vector types
@ 2021-10-15  2:24 gabravier at gmail dot com
  2021-10-15  2:30 ` [Bug target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related) pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gabravier at gmail dot com @ 2021-10-15  2:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102758
           Summary: [x86] Failure to use registers optimally when swapping
                    between (identically represented) vector types
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

#include <stdint.h>

typedef int64_t v2i64 __attribute__((vector_size(16)));
typedef uint16_t v8u16 __attribute__((vector_size(16)));

v2i64 f(v8u16 make_b_xxm1, v2i64 b)
{
    return (v2i64)((v8u16)b + (v8u16){1});
}

With -O3, GCC outputs this:

f(unsigned short __vector(8), long __vector(2)):
        movdqa  xmm2, XMMWORD PTR .LC0[rip]
        paddw   xmm2, xmm1
        movdqa  xmm0, xmm2
        ret

LLVM outputs this:

f(unsigned short __vector(8), long __vector(2)):
        movdqa  xmm0, xmm1
        paddw   xmm0, xmmword ptr [rip + .LCPI0_0]
        ret

It should be possible to optimize out the last `movdqa`. This seems to be
directly related to the usage of differing types here (even though the
conversion is cost-free) as replacing all usage of `v2i64` with `v8u16` makes
this be better optimized.

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

end of thread, other threads:[~2023-05-08 12:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15  2:24 [Bug target/102758] New: [x86] Failure to use registers optimally when swapping between (identically represented) vector types gabravier at gmail dot com
2021-10-15  2:30 ` [Bug target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related) pinskia at gcc dot gnu.org
2021-10-15  2:42 ` [Bug target/102758] [12 Regression] Failure to use registers optimally with return values (2 operands related and subreg) pinskia at gcc dot gnu.org
2021-10-15  6:28 ` rguenth at gcc dot gnu.org
2021-12-03 16:37 ` rsandifo at gcc dot gnu.org
2022-05-06  8:31 ` [Bug target/102758] [12/13 " jakub at gcc dot gnu.org
2022-10-19  9:40 ` rguenth at gcc dot gnu.org
2023-05-08 12:22 ` [Bug target/102758] [12/13/14 " rguenth at gcc dot gnu.org

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