https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78103
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |segher at gcc dot gnu.org --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Unfortunately, it doesn't work for the #c0 testcase, after the combiner splitter kicks in, the combiner doesn't even try that 4 insn combination. Haven't debugged it, but it looks like if LOG_LINKS isn't added between the 2 insns that replaced the 3 insns. There is the successful: Trying 9, 10 -> 12: 9: {flags:CCZ=cmp(r85:DI,0);r86:DI=0x3f-clz(r85:DI);} REG_DEAD r85:DI REG_UNUSED flags:CCZ 10: {r86:DI=r86:DI^0x3f;clobber flags:CC;} REG_UNUSED flags:CC 12: r87:DI=sign_extend(r86:DI#0) REG_DEAD r86:DI Failed to match this instruction: (set (reg:DI 87 [ _1 ]) (xor:DI (sign_extend:DI (minus:SI (const_int 63 [0x3f]) (subreg:SI (clz:DI (reg/v:DI 85 [ x ])) 0))) (const_int 63 [0x3f]))) Splitting with gen_split_440 (i386.md:14804) Successfully matched this instruction: (set (reg:DI 93) (minus:DI (const_int 63 [0x3f]) (clz:DI (reg/v:DI 85 [ x ])))) Successfully matched this instruction: (set (reg:DI 87 [ _1 ]) (zero_extend:DI (xor:SI (subreg:SI (reg:DI 93) 0) (const_int 63 [0x3f])))) allowing combination of insns 9, 10 and 12 original costs 8 + 4 + 4 = 16 replacement costs 8 + 5 = 13 deferring deletion of insn with uid = 9. modifying insn i2 10: {r93:DI=0x3f-clz(r85:DI);clobber flags:CC;} REG_UNUSED flags:CC REG_DEAD r85:DI deferring rescan insn with uid = 10. modifying insn i3 12: {r87:DI=zero_extend(r93:DI#0^0x3f);clobber flags:CC;} REG_UNUSED flags:CC deferring rescan insn with uid = 12. and I was hoping that the combiner would soon try 10, 12, 13 -> 14 combination where 10 and 12 are the above 2 new insns, 13 is r88:DI=0x40 and 14 is {r85:DI=r88:DI-r87:DI;clobber flags:CC;}. But all it tries is 12 -> 14, 13 -> 14, 13, 12 -> 14 and all those fail. Segher, any ideas?