https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118012
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|tree-optimization |middle-end
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
/* Expand X*Y as X&-Y when Y must be zero or one. */
...
if (bit0_p || bit1_p)
{
bool speed = optimize_insn_for_speed_p ();
int cost = add_cost (speed, mode) + neg_cost (speed, mode);
struct algorithm algorithm;
enum mult_variant variant;
if (CONST_INT_P (op1)
? !choose_mult_variant (mode, INTVAL (op1),
&algorithm, &variant, cost)
: cost < mul_cost (speed, mode))
Note this should have a debug print in dump_file but that is a different story.
So maybe we are not doing the right costs here.
Or we should have another choice of how to expand `a * onezero` into `onezero ?
a : 0`