https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120926
Bug ID: 120926 Summary: Optimise away SVE PTRUE when applied to CNTP instruction 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: ktkachov at gcc dot gnu.org Target Milestone: --- Target: aarch64 #include <arm_sve.h> uint64_t foo(svbool_t p) { return svcntp_b64(svptrue_b64(), p); } generates: foo: ptrue p3.b, all cntp x0, p3, p0.d ret But I think it could generate: foo: cntp x0, p0, p0.d ret As the CNTP instruction effectively performs an AND of the source and governing predicates.