public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111002] New: Code generation for vectorized -(a[i] != 0) with number of elements chang could be improved
@ 2023-08-12  9:37 pinskia at gcc dot gnu.org
  2023-08-12  9:42 ` [Bug tree-optimization/111002] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-12  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111002
           Summary: Code generation for vectorized -(a[i] != 0) with
                    number of elements chang could be improved
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Testcase:
```
void __attribute__ ((noipa))
f (int *__restrict r,
   int *__restrict a,
   short *__restrict pred)
{
  for (int i = 0; i < 1024; ++i)
    r[i] = pred[i] != 0 ? -1 : 0;
}
```

Kinda of patch:
```
/* Sink unary operations to branches, but only if we do fold both.  */
(for op (negate bit_not abs absu)
 (simplify
  (op (view_convert? (vec_cond:s @0 @1 @2)))
  (if (element_precision (type) == element_precision (@1))
   (vec_cond @0 (op! (view_convert @1)) (op! (view_convert @2))))))
```

That is `Sink unary operations` one needs to add support for view_convert there
...

I Noticed this while working on PR 110986 (but is not needed for that issue).

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

end of thread, other threads:[~2023-08-21  7:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-12  9:37 [Bug tree-optimization/111002] New: Code generation for vectorized -(a[i] != 0) with number of elements chang could be improved pinskia at gcc dot gnu.org
2023-08-12  9:42 ` [Bug tree-optimization/111002] " pinskia at gcc dot gnu.org
2023-08-21  0:06 ` pinskia at gcc dot gnu.org
2023-08-21  3:22 ` [Bug tree-optimization/111002] Code generation for vectorized -(a[i] != 0) with number of elements change " pinskia at gcc dot gnu.org
2023-08-21  7:45 ` cvs-commit at gcc dot gnu.org
2023-08-21  7:47 ` 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).