public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112892] New: MAX<VEC_PERM<a,a,c>, VEC_PERM<b,b,c>> could be just VEC_PERM<MAX<a,b>,...,c>
@ 2023-12-07  2:02 pinskia at gcc dot gnu.org
  2023-12-07  7:29 ` [Bug tree-optimization/112892] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-07  2:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112892
           Summary: MAX<VEC_PERM<a,a,c>, VEC_PERM<b,b,c>> could be just
                    VEC_PERM<MAX<a,b>,...,c>
           Product: gcc
           Version: 14.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: ---

Take:
```
static inline int MAX(int a, int b)
{
        if (a < b)  return b;
        return a;
}

void f(int *a, int n)
{
  n = 128;
  int i;
  for(i = n-1; i >= 1; i--)
  {
    a[i] = MAX(a[i], a[i-1]);
  }
}
```
Currently we vectorize to:
```
  vect__4.9_43 = MEM <vector(4) int> [(int *)vectp_a.7_41];
  vect__4.10_44 = VEC_PERM_EXPR <vect__4.9_43, vect__4.9_43, { 3, 2, 1, 0 }>;
  vect__7.13_48 = MEM <vector(4) int> [(int *)vectp_a.7_41 + -4B];
  vect__7.14_49 = VEC_PERM_EXPR <vect__7.13_48, vect__7.13_48, { 3, 2, 1, 0 }>;
  vect__12.15_50 = MAX_EXPR <vect__4.10_44, vect__7.14_49>;
  vect__12.18_54 = VEC_PERM_EXPR <vect__12.15_50, vect__12.15_50, { 3, 2, 1, 0
}>;
  MEM <vector(4) int> [(int *)vectp_a.7_41] = vect__12.18_54;
```

But the VEC_PERMs here can be removed ...
as we are generating the opposite vector and such.

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

* [Bug tree-optimization/112892] MAX<VEC_PERM<a,a,c>, VEC_PERM<b,b,c>> could be just VEC_PERM<MAX<a,b>,...,c>
  2023-12-07  2:02 [Bug tree-optimization/112892] New: MAX<VEC_PERM<a,a,c>, VEC_PERM<b,b,c>> could be just VEC_PERM<MAX<a,b>,...,c> pinskia at gcc dot gnu.org
@ 2023-12-07  7:29 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-07  7:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Turns out this is a dup of bug 61338 .

*** This bug has been marked as a duplicate of bug 61338 ***

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

end of thread, other threads:[~2023-12-07  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-07  2:02 [Bug tree-optimization/112892] New: MAX<VEC_PERM<a,a,c>, VEC_PERM<b,b,c>> could be just VEC_PERM<MAX<a,b>,...,c> pinskia at gcc dot gnu.org
2023-12-07  7:29 ` [Bug tree-optimization/112892] " 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).