public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/115571] New: `cmp * float` vs `tmp_bool * float` and better vectorization for `cmp * float`
@ 2024-06-21  1:15 pinskia at gcc dot gnu.org
  2024-06-21  7:46 ` [Bug tree-optimization/115571] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-21  1:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115571
           Summary: `cmp * float` vs `tmp_bool * float` and better
                    vectorization for `cmp * float`
           Product: gcc
           Version: 15.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:
```
void f(float *c, int *a)
{
  for (int i = 0; i < 1024; i++)
  {
    bool t = a[i] == 10;
    c[i] = t * c[i];
  }
}

void f1(float *c, int *a)
{
  for (int i = 0; i < 1024; i++)
  {
    c[i] = (a[i] == 10) * c[i];
  }
}
```

The second one is vectorized better than the first one at -Ofast due to the
second one being converted into `(a[i] == 10) ? c : 0` in fold before
gimplification.

This was inspired by https://github.com/llvm/llvm-project/pull/96216 .

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

* [Bug tree-optimization/115571] `cmp * float` vs `tmp_bool * float` and better vectorization for `cmp * float`
  2024-06-21  1:15 [Bug tree-optimization/115571] New: `cmp * float` vs `tmp_bool * float` and better vectorization for `cmp * float` pinskia at gcc dot gnu.org
@ 2024-06-21  7:46 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-21  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-06-21
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2024-06-21  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-21  1:15 [Bug tree-optimization/115571] New: `cmp * float` vs `tmp_bool * float` and better vectorization for `cmp * float` pinskia at gcc dot gnu.org
2024-06-21  7:46 ` [Bug tree-optimization/115571] " 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).