On Mon, Sep 28, 2026 at 3:07 PM Dominic P <[email protected]> wrote: > > Hi Kyrill, Andrea, > > Since r17-4663 (PR127485) the d == 0 edge of d = a - b records a == b, > so threadfull1 threads through a following (a >= b ? 1 : 0) diamond > before phiopt can form the comparison. In lib6502's M6502_run at -O2 > that is +180 bytes on arm, +300 on aarch64 and +165 on x86_64. Reduced: > > typedef unsigned char byte; > byte cmp (byte p, byte r, byte b) > { > byte d = r - b; > return (byte) ((p & (byte) ~0x83) | (d & 0x80) > | (!d ? 2 : 0) | (r >= b ? 1 : 0)); > } > > 1/2 still applies to trunk a924d879f01 and restores those sizes; on the > reduced case it executes 21% fewer insns on arm and 8%/15% more on > aarch64/x86_64, where the threaded path skips a setcc. In x86_64 > tree-ssa.exp and dg.exp, pr105679.c and ssa-thread-27.c then need > -fdisable-tree-phiopt1 (I have that change) and pr108357.c keeps foo > (PR127292). Without the embedded-diamond guard, ssa-ifcombine-7 goes > from 5 to 8 insns on x86_64. That is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127654 specifically now; though I thought I had reviewed a different patch for that too.
> Andrea, is 1/2 going in with your phiopt work? Yes, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126043 . See the dependent bug reports (though there might be others not recorded at this point). E.g. some floating point ifcombining work. > > Thanks, > Dominic
