https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125907
--- Comment #4 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Hongtao Liu from comment #3)
> >
> > But it only accepts nonimmediate_operand, but here for the testcase in the
> > PR, it's const_int 0
> >
> > Failed to match this instruction:
> > (set (reg:SI 99 [ <retval> ])
> > (if_then_else:SI (ne (and:SI (reg:SI 103 [ _1 ])
> > (const_int 1 [0x1]))
> > (const_int 0 [0]))
> > (reg:SI 107 [ c ])
> > (const_int 0 [0])))
>
> Also it's not simplified to zero_extract
It's related gimple pass uncprop1
uncprop1 substitutes the constant 0 in the PHI with _3 (the and result, known
== 0 on that edge), which keeps _3 live and blocks the bt form.
<bb 2> [local count: 1073741824]:
# DEBUG BEGIN_STMT
_1 = 1 << b_5(D);
_2 = (unsigned int) _1;
_3 = _2 & a_6(D);
if (_3 != 0)
goto <bb 5>; [50.00%]
else
goto <bb 3>; [50.00%]
<bb 5> [local count: 536870912]:
goto <bb 4>; [100.00%]
<bb 3> [local count: 536870912]:
<bb 4> [local count: 1073741824]:
# _4 = PHI <_3(3), c_7(D)(5)> --- original PHI <0(3), c_7(5)>
return _4;
The initilization of 0 is very cheap, not sure if it's worth to do uncprop for
it.