public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101540] New: CONSTRUCTOR for vector(1) should just be VCE
@ 2021-07-20 22:01 pinskia at gcc dot gnu.org
  2021-07-21  7:00 ` [Bug tree-optimization/101540] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-20 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101540
           Summary: CONSTRUCTOR for vector(1) should just be VCE
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

I noticed with the following source:
typedef unsigned char __attribute__((__vector_size__ (1))) W;
typedef unsigned char __attribute__((__vector_size__ (8))) V;
typedef unsigned short __attribute__((__vector_size__ (16))) U;

unsigned short us;

W
foo (unsigned char uc)
{
  V v = __builtin_convertvector ((U){ } >= us, V);
  return __builtin_shufflevector ((W){ }, v, 4) & uc;
}

int
main (void)
{
  W x = foo (5);
  if (x[0] != 5)
    __builtin_abort();
  return 0;
}
----- CUT ----
We produce
_6 = {uc_10(D)};
But this should be the same as
_6 = VIEW_CONVERT_EXPR<uc_10>

--- CUT ---
This is what we get in the IR:
  _6 = {uc_10(D)};
  _14 = BIT_FIELD_REF <_4, 8, 0>;
  _15 = VIEW_CONVERT_EXPR<unsigned char>(_6);
  _16 = _14 & _15;
  _17 = VIEW_CONVERT_EXPR<W>(_16);

We do change the BIT_FIELD_REF that was assigned to _15 to a VCE though.

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

end of thread, other threads:[~2021-11-28 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 22:01 [Bug tree-optimization/101540] New: CONSTRUCTOR for vector(1) should just be VCE pinskia at gcc dot gnu.org
2021-07-21  7:00 ` [Bug tree-optimization/101540] " rguenth at gcc dot gnu.org
2021-11-28  8:55 ` pinskia at gcc dot gnu.org
2021-11-28 17:57 ` pinskia 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).