https://gcc.gnu.org/g:a8677a123a62db69fbde06c7530fb2c0ee3e09c4

commit r17-6521-ga8677a123a62db69fbde06c7530fb2c0ee3e09c4
Author: Andrea Pinski <[email protected]>
Date:   Thu Nov 19 21:04:46 2026 -0800

    match/forwprop: Remove the shift capture from mul_carry_cross_sum
    
    I was looking into seeing what testcases would fail if I allowed
    everything in the early phiopt.  And long-mul-two-carry.c was failing
    because it was being optimized earlier.
    This does not change to optimize long-mul-two-carry.c at forwprop1
    but it is a step in that direction.
    The shift capture from mul_carry_cross_sum is unused in checking to
    make sure it is valid or not.  So let's remove it. It will
    also allow for a `cond^` version of mul_carry_cross_sum to happen
    which allows for long-mul-two-carry.c to be optimized at forwprop1.
    
    Boostrapped and tested on x86_64-linux-gnu.
    
    gcc/ChangeLog:
    
            * match.pd (mul_carry_cross_sum): Remove @0 from the capture lists.
            * tree-ssa-forwprop.cc (long_mul_summand::set): For
            LMK_CARRY_CROSS_SUM don't set the shift_idx.
    
    Signed-off-by: Andrea Pinski <[email protected]>

Diff:
---
 gcc/match.pd             | 2 +-
 gcc/tree-ssa-forwprop.cc | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index fa163a36bf53..f12f3f3e6276 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -13555,7 +13555,7 @@ and,
 /* 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.  */
-(match (mul_carry_cross_sum @mul_hilo0 @mul_hilo1 @mul_hilo2 @0)
+(match (mul_carry_cross_sum @mul_hilo0 @mul_hilo1 @mul_hilo2)
   (lshift
     (convert (gt
       @mul_hilo0
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index f9be9118f5d2..508b49ae4919 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -3917,7 +3917,6 @@ long_mul_summand::set (long_mul_kind kind, const tree 
*res_ops)
       break;
     case LMK_CARRY_CROSS_SUM:
       n_hilos = 3;
-      shift_idx = 3;
       break;
     case LMK_CARRY_LOW_SUM:
       n_ops = 2;

Reply via email to