https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118150
Bug ID: 118150
Summary: Failure to fold NOT+PTEST to NOTS for SVE
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: aarch64-sve, missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: rsandifo at gcc dot gnu.org
CC: tnfchris at gcc dot gnu.org
Target Milestone: ---
Target: aarch64*-*-*
#include <arm_sve.h>
int
foo (svbool_t x, int y, int z)
{
return svptest_any(svptrue_b8(), svnot_z(svptrue_b8(), x)) ? y : z;
}
generates:
foo:
ptrue p3.b, all
not p0.b, p3/z, p0.b
ptest p3, p0.b
csel w0, w1, w0, none
ret
instead of LLVM's:
foo:
ptrue p1.b
nots p0.b, p1/z, p0.b
csel w0, w0, w1, ne
ret
because we don't have any combiner patterns for NOT+PTEST.
[HT to Tamar for the spot]