[gcc r17-3539] match: Remove unused result captures from the widdening multiply matches
Andrea Pinski via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:b1dadc61cd727cc8760676a9f0190ebe5acbe39c commit r17-3539-gb1dadc61cd727cc8760676a9f0190ebe5acbe39c Author: Andrea Pinski <[email protected]> Date: Fri Aug 21 20:10:46 2026 -0700 match: Remove unused result captures from the widdening multiply matches Since we don't need these captures from forwprop, let's remove them. This reduces what is being stored in the result ops so it can slightly speed up the compiler. Pushed as obvious after bootstrapp/test on x86_64-linux-gnu. gcc/ChangeLog: * match.pd (mul_carry_low_sum): Remove @1 from the result captures. Rename @0 to @shift0. (mul_low_accum): Likewise. (mul_ladder_sum1): Likewise. (mul_ladder_sum2): Likewise. (mul_ladder_sum3): Likewise. Signed-off-by: Andrea Pinski <[email protected]> Diff: --- gcc/match.pd | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index db1938f6f881..8ab46d83b147 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -12852,14 +12852,14 @@ and, /* Carry from low-sum overflow: (cast?) (hilo > low_sum) << N. No explicit type/width guard needed: mul_low_sum delegates to mul_cross_sum + mul_hi + mul_lolo, which provide deep structural - constraints, and @0 ties the shift amount to the inner constants. */ -(match (mul_carry_low_sum @op0 @op1 @mul_hilo0 @mul_hilo1 @mul_hilo2 @0 @1) + constraints, and @shift0 ties the shift amount to the inner constants. */ +(match (mul_carry_low_sum @op0 @op1 @mul_hilo0 @mul_hilo1 @mul_hilo2 @shift0) (lshift (convert (gt @mul_hilo0 - (mul_low_sum @op0 @op1 @mul_hilo1 @mul_hilo2 @0 + (mul_low_sum @op0 @op1 @mul_hilo1 @mul_hilo2 @shift0 @1))) - @0)) + @shift0)) /* Carry from cross-sum overflow: (cast?) (hilo > cross_sum) << N. Explicit guard required because mul_cross_sum is just (plus:c @0 @1) with no inherent type or halfwidth constraint. */ @@ -12882,7 +12882,7 @@ and, (with { tree op_type = TREE_TYPE (@0); } (if (INTEGRAL_TYPE_P (op_type) && TYPE_UNSIGNED (op_type))))) /* Low accumulate: (xl*yl >> N) + (cross_sum & mask). */ -(match (mul_low_accum @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_low_accum @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (mul_hi (mul_lolo @op0 @op1 @0) @@ -12891,7 +12891,7 @@ and, /* Ladder sum form 1: (hilo0 & mask) + hilo1 + (xl*yl >> N). First variant: @mul_hilo1 is inside the inner plus:c alongside (mul_lo ...). */ -(match (mul_ladder_sum1 @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_ladder_sum1 @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (plus:c (mul_lo @@ -12901,7 +12901,7 @@ and, (mul_hi (mul_lolo @op0 @op1 @0) @1))) /* Second variant: @mul_hilo1 is the outermost addend and could match anything, so guard that its definition is a MULT_EXPR. */ -(match (mul_ladder_sum1 @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_ladder_sum1 @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (plus:c (mul_lo @mul_hilo0 @0) @@ -12913,25 +12913,26 @@ and, (mul_hi (mul_lolo @op0 @op1 @0) @1) @mul_hilo0)) /* Ladder sum form 2: (ladder_part_sum & mask) + hilo. */ -(match (mul_ladder_sum2 @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_ladder_sum2 @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (mul_lo (mul_ladder_part_sum @op0 @op1 @mul_hilo0 @0 @1) @0) @mul_hilo1)) /* Ladder sum form 3: (hilo0 & mask) + (hilo1 & mask) + (xl*yl >> N). */ -(match (mul_ladder_sum3 @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_ladder_sum3 @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (plus:c (mul_lo @mul_hilo0 @0) (mul_lo @mul_hilo1 @0)) (mul_hi (mul_lolo @op0 @op1 @0) @1))) -(match (mul_ladder_sum3 @op0 @op1 @mul_hilo0 @mul_hilo1 @0 @1) +(match (mul_ladder_sum3 @op0 @op1 @mul_hilo0 @mul_hilo1) (plus:c (plus:c (mul_lo @mul_hilo0 @0) (mul_hi (mul_lolo @op0 @op1 @0) @1)) (mul_lo @mul_hilo1 @0))) + /* Long-multiply high-part emit chain produced by forwprop's recognizer: (N) ((2N) op1 * (2N) op2) >> N