https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118150
--- Comment #4 from Spencer Abson <sabson at gcc dot gnu.org> ---
For a similar reason, we're also missing BIC+PTEST under the same
conditions:
int
bar (svbool_t a, svbool_t b)
{
svbool_t c = svptrue_b8();
return svptest_first (c, svbic_z (c, a, b));
}
generates:
bar:
ptrue p3.b, all
not p0.b, p0/z, p1.b
ptest p3, p0.b
cset w0, first
ret
instead of LLVM's
bar:
ptrue p2.b
bics p0.b, p2/z, p0.b, p1.b
cset w0, mi
ret
Because predicated BIC is expanded into generic RTL as:
(and (and (not (b)) (a)) (c)) ; aarch64_pred_bicvnx16bi_z
And c is all-true, this can be reduced to the idiom for predicated
NOT (after cse1):
(and (not (b)) (a)) ; one_cmplvnx16bi3
For CC_NZC, it wouldn't be valid to fold the PTEST into a NOTS
here.