public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
       [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
@ 2012-07-13  8:54 ` rguenth at gcc dot gnu.org
  2012-07-13 11:04 ` steven at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-13  8:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21998

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53947

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-13 08:54:14 UTC ---
Link to vectorizer missed-optimization meta-bug.


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

* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
       [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
  2012-07-13  8:54 ` [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store) rguenth at gcc dot gnu.org
@ 2012-07-13 11:04 ` steven at gcc dot gnu.org
  2012-07-13 11:29 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu.org @ 2012-07-13 11:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21998

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |steven at gcc dot gnu.org

--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-07-13 11:04:13 UTC ---
(In reply to comment #1)
> They are not equivalent to GCC, the first always stores, the second has a
> conditional store.

Just to clarify, 7 years later: To GCC the two procedures are not equivalent.

In the first procedure,
 a1[i] = (a1[i] == v1 ? v2 : a1[i]);

expands as:

  if (a1[i] == v1)
    a1[i] = v2;
  else
    a1[i] = a1[i];

while the second procedure expands just as-is:
  if (a1[i] == v1)
    a1[i] = v2;

In the first case, there will always be a store to a1[i], in the second example
this is not the case. Introducing new stores is not allowed, to avoid
introducing data races, see http://gcc.gnu.org/wiki/Atomic/GCCMM/DataRaces.

I'm not sure how GCC should transform the second procedure to allow the loop to
be vectorized.


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

* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
       [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
  2012-07-13  8:54 ` [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store) rguenth at gcc dot gnu.org
  2012-07-13 11:04 ` steven at gcc dot gnu.org
@ 2012-07-13 11:29 ` rguenth at gcc dot gnu.org
  2013-03-27 11:32 ` rguenth at gcc dot gnu.org
  2023-08-04 20:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-13 11:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21998

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-13 11:28:45 UTC ---
We have two related flags here, -ftree-loop-if-convert-stores, and
--param allow-store-data-races.  We can adjust the former to honor the
latter if specified and then eventually vectorize this, too.


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

* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
       [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-07-13 11:29 ` rguenth at gcc dot gnu.org
@ 2013-03-27 11:32 ` rguenth at gcc dot gnu.org
  2023-08-04 20:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-27 11:32 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21998

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-27 11:32:19 UTC ---
Note that the concern is also that a1 may be mapped to a read-only segment,
so introducing a store data-race may trap.  That's probably out of the C99
language standards scope, but the middle-end has to care about this
possibility.


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

* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
       [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-03-27 11:32 ` rguenth at gcc dot gnu.org
@ 2023-08-04 20:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-04 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
We can vectorize test2 using mask stores ....

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

* [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store)
  2005-06-10 13:22 [Bug tree-optimization/21998] New: (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't stefaan dot deroeck at gmail dot com
@ 2005-06-19 14:24 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-19 14:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-19 14:24 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-19 14:24:25
               date|                            |
            Summary|(cond ? result1 : result2)  |(cond ? result1 : result2)
                   |is vectorized, where        |is vectorized, where
                   |equivalent if-syntax isn't  |equivalent if-syntax isn't
                   |                            |(store)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21998


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

end of thread, other threads:[~2023-08-04 20:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21998-4@http.gcc.gnu.org/bugzilla/>
2012-07-13  8:54 ` [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store) rguenth at gcc dot gnu.org
2012-07-13 11:04 ` steven at gcc dot gnu.org
2012-07-13 11:29 ` rguenth at gcc dot gnu.org
2013-03-27 11:32 ` rguenth at gcc dot gnu.org
2023-08-04 20:36 ` pinskia at gcc dot gnu.org
2005-06-10 13:22 [Bug tree-optimization/21998] New: (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't stefaan dot deroeck at gmail dot com
2005-06-19 14:24 ` [Bug tree-optimization/21998] (cond ? result1 : result2) is vectorized, where equivalent if-syntax isn't (store) pinskia at gcc dot gnu dot 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).