This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/68557] Missed x86 peephole optimization for multiplying by a bool
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 26 Nov 2015 14:51:46 +0000
- Subject: [Bug tree-optimization/68557] Missed x86 peephole optimization for multiplying by a bool
- Auto-submitted: auto-generated
- References: <bug-68557-4 at http dot gcc dot gnu dot org/bugzilla/>
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.