https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126954
Bug ID: 126954
Summary: mul_ladder_sum1 match pattern can be simplified
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
/* 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)
(plus:c
(plus:c
(mul_lo @mul_hilo0 INTEGER_CST@0)
(mul_hi (mul_lolo @op0 @op1 INTEGER_CST@0) INTEGER_CST@1))
@mul_hilo1)
(with {
tree_code mul_hilo_code = TREE_CODE (@mul_hilo1);
tree_code rhs_code = ERROR_MARK;
if (mul_hilo_code == SSA_NAME)
{
gimple *def = SSA_NAME_DEF_STMT (@mul_hilo1);
if (def && gimple_code (def) == GIMPLE_ASSIGN)
rhs_code = gimple_assign_rhs_code (def);
} }
(if (rhs_code == MULT_EXPR))))
Just to:
/* 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)
(plus:c
(plus:c
(mul_lo @mul_hilo0 INTEGER_CST@0)
(mul_hi (mul_lolo @op0 @op1 INTEGER_CST@0) INTEGER_CST@1))
(mult@mul_hilo1 @2 @3)))