[Bug tree-optimization/68557] Missed x86 peephole optimization for multiplying by a bool
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 26 14:51:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list