This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/68557] Missed x86 peephole optimization for multiplying by a bool


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-11-26
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
it's larger though (so not -Os).  If 'b' is already available as condition code
then a conditonal move from zero would also work.

So I wonder how to represent this on the GIMPLE level.

  _2 = COND_EXPR <b_3 ? x_4 : 0>;

is a possibility and of course

  _2 = COND_EXPR <b_3 ? -1 : 0>;
  _5 = x_4 & _2;

or

  _3 = (int) b_2;
  _4 = -_3;  // only if bool is unsigned
  _5 = x_6 & _4;

the latter rely on the bool having only a the LSB set.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]