match: Add missing :c specifier to gt in mul_carry_low_sum and mul_carry_cross_sum
Corrects operand ordering in match patterns for mul_carry_low_sum and mul_carry_cross_sum.
This commit adds the missing :c specifier to the gt (greater than) comparison in the mul_carry_low_sum and mul_carry_cross_sum patterns within GCC’s match component. This correction ensures that the order of operands in these patterns can be swapped, preventing incorrect optimizations when operand order is significant. A new test case is introduced to verify this fix.
In Details
The match.pd files in GCC define patterns for recognizing and transforming intermediate representation (IR) constructs. In mul_carry_low_sum and mul_carry_cross_sum, the gt comparison was missing the :c specifier. This specifier allows the pattern matcher to consider the operands in either order (i.e., a gt b or b gt a). Without it, the pattern strictly expects a specific order, which can lead to incorrect matches and subsequent optimizations. This change ensures the patterns are more robust and correctly handle operand commutativity where applicable.
- match
- Refers to the pattern matching subsystem in GCC, used to identify and optimize specific intermediate representation (IR) constructs.
- mul_carry_low_sum
- A pattern within GCC's match system, likely representing a multiplication operation that produces a low-order sum and a carry-out.
- mul_carry_cross_sum
- Similar to
mul_carry_low_sum, this pattern likely involves multiplication with carry, potentially across different parts of the result. - gt
- Represents the 'greater than' comparison operator.
- :c
- A specifier used in GCC's match-compile system pattern definitions. The
:cspecifier indicates that the order of the operands for the preceding operator (e.g.,gt) can be swapped (commutative). - tree-ssa
- Static Single Assignment form. An intermediate representation in compilers where every variable is assigned exactly once, simplifying many optimization passes.