Expand complex multiplication patterns to cover all operand orderings
Enable vectorizer to consider all 8 multiplication orderings for complex patterns to match more code.
This commit enhances the vectorizer’s ability to match complex multiplication patterns by enabling it to try all eight possible orderings of operands and multiplication variants. Previously, only a limited set of operand permutations were considered. This broader matching, combined with existing checks like compatible_complex_nodes_p and data flow analysis, ensures that more valid complex multiplication code can be vectorized without accepting incorrect combinations. This change is a prerequisite for correctly applying the signed zero handling fix on AArch64.
In Details
The vect_validate_multiplication function has been refactored, introducing vect_validate_multiplication_commutative to handle all eight multiplication variants (including operand permutations and conjugate variants) for complex patterns. This broadens the scope of what the vectorizer can match, especially for complex number operations. The existing checks, such as compatible_complex_nodes_p and data flow analysis within linear_loads_p, still filter out invalid combinations, ensuring that only semantically correct transformations are applied. This is essential for comprehensive pattern…
- Complex Multiplication Patterns
- Predefined code structures or patterns that the compiler's vectorizer uses to recognize and optimize the multiplication of complex numbers.
- Operand Orderings
- The different ways in which the operands of an operation can be arranged. For multiplication, this includes swapping the operands and considering their conjugates.
- Vectorizer
- A compiler component that transforms loops operating on single data elements into loops that operate on multiple data elements simultaneously using SIMD instructions.
- Data Flow Analysis
- A static analysis technique used by compilers to gather information about the possible values of variables at different points in a program's execution, aiding in optimization.