[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2022-11-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #9 from Andrew Pinski  ---
.

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2022-11-25 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |10.0

--- Comment #8 from Andrew Pinski  ---
Fixed for GCC 10 by the same patch which fixed PR 87954 .

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2021-07-06 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Andrew Pinski  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org

--- Comment #7 from Andrew Pinski  ---
Mine.

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2020-11-06 Thread gabravier at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Gabriel Ravier  changed:

   What|Removed |Added

 CC||gabravier at gmail dot com

--- Comment #6 from Gabriel Ravier  ---
Looks like it is now indeed optimized to a boolean and, at least on the latest
trunk I could test...

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2018-11-09 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

--- Comment #5 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #4)
> /* (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0  */
> (for cmp (gt lt ge le)
> (simplify
>  (mult (convert (cmp @0 @1)) @2)
>   (cond (cmp @0 @1) @2 { build_zero_cst (type); })))
> 
> 
> Should have caught that ...

We do get:
  _1 = c_5(D) < d_6(D);
  _2 = (int) _1;
  _7 = a_3(D) < b_4(D) ? _2 : 0;

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2018-11-09 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

--- Comment #4 from Andrew Pinski  ---
/* (m1 CMP m2) * d -> (m1 CMP m2) ? d : 0  */
(for cmp (gt lt ge le)
(simplify
 (mult (convert (cmp @0 @1)) @2)
  (cond (cmp @0 @1) @2 { build_zero_cst (type); })))


Should have caught that ...
NOTE I think that might have been broken for floating point 

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2016-04-05 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

--- Comment #3 from Marc Glisse  ---
In this case, the code was deliberately written this way, presumably to avoid
the branching in &&. Using & would be better (and that's what I am suggesting
we optimize it to), but * doesn't seem nonsensical to me. (we can still add a
warning if you want)

PR 45780 seems to be about something completely different, and the code here
would not trigger the warning requested there (the result is the same if we
replace bool by int everywhere).

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2016-04-05 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez  ---
Hum, perhaps we should warn about such nonsense code, as suggested in PR45780:

warning: arithmetic applied to boolean expression
   return (a

[Bug tree-optimization/70547] Optimize multiplication of booleans to bit_and

2016-04-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70547

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-04-05
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.