[Bug tree-optimization/107090] [aarch64] sequence logic should be combined with mul and umulh
"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107090 --- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Philipp Tomsich <[email protected]>: https://gcc.gnu.org/g:6c598e2be7d0adf937d3390bb8f6a16b39603016 commit r17-3438-g6c598e2be7d0adf937d3390bb8f6a16b39603016 Author: Konstantinos Eleftheriou <[email protected]> Date: Thu Jun 25 06:01:26 2026 -0700 forwprop: Add long-multiply carry-low-sum variant Extend the long-multiply fold to the variant that collapses the cross sum and the low partial product into a single low_sum and tests the overflow compare against it: xh*yh + (low_sum >> N) + ((hilo > low_sum) << N) low_sum = cross_sum + (xl*yl >> N) cross_sum = xh*yl + xl*yh The outer chain has three summands instead of four; the corresponding LOW_PART recovers (xl*yl & mask) | (low_sum << N). PR tree-optimization/107090 gcc/ChangeLog: * match.pd: Add mul_low_sum and mul_carry_low_sum atom recognizers. * tree-ssa-forwprop.cc (gimple_mul_low_sum): Declare. (gimple_mul_carry_low_sum): Likewise. (create_mul_low_seq): Update the widest-atom note above LONG_MUL_MAX_CAPTURES to mul_carry_low_sum (7 captures). (enum long_mul_kind): Add LMK_LOW_SUM and LMK_CARRY_LOW_SUM, with the long_mul_table HIGH_PART and LOW_PART rows that consume them. (long_mul_set_summand): Handle the new kinds. (long_mul_classify_carry): Try mul_carry_low_sum before mul_carry_cross_sum (most-specific first). (long_mul_classify_plus_kinds): Try mul_low_sum after mul_low_accum (mul_low_sum's first arm is any plus and mul_low_accum constrains both arms). gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/long-mul-carry.c: Add carry-low-sum coverage (mulh_carry_low_sum, full_mul_carry_low_sum, mulh_carry_low_sum_comm, mulh_carry_low_sum_lohi, mulh_carry_low_sum_128, mulh_carry_low_sum_v2i32) and update fold counts.