https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118974
Tamar Christina <tnfchris at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2025-02-21 --- Comment #1 from Tamar Christina <tnfchris at gcc dot gnu.org> --- Confirmed, I had submitted a patch for this a few years ago but it never got a review/help I requested https://patchwork.sourceware.org/project/gcc/patch/zjw6svuwbaxlp...@arm.com/ I was stuck on being able to do this in RTL because the problem is that the sequence in gimple is b = a > 0 if (c != 0) break and so the cbranch expansion doesn't always see the actual comparison being done. And if you try to match them up in RTL it becomes very complicated as the patch above showed. I've been thinking about it again, but this time I'd instead change it so that expand gives the comparison as the operation to cbranch. This removes the complication of trying to match an SVE and Adv. SIMD compare into one. But this can only be done if the target supports more than 0 as the second operand. because e.g. MVE can do c != 0, but not b1 > b2, where they're both predicates. Also: cmpgt p14.s, p7/z, z28.s, #0 ptest p15, p14.b b.none .L3 should be: cmpgt p14.s, p7/z, z28.s, #0 b.none .L3 we don't need the ptest since we only use b.none or b.any and the size of the predicate of the ptest is smaller than the original. This however is a general problem with SVE codegen in GCC and not cbranch related. The CC elimination pass needs to be expanded here, I think Richard was playing with extending it to do this.