match.pd: Make vector copysign conversion rules float-safe.
Vector copysign conversions now use element precision to avoid tree evaluation ICEs.
This commit enhances the match.pd optimization rules to safely handle vectorized copysign operations, particularly when converting between different floating-point precisions. Previously, these rules evaluated TYPE_PRECISION on vector types, leading to Internal Compiler Errors (ICEs). The fix replaces this with element_precision, mirroring a similar change for abs operations. This ensures that the precision checks are correctly evaluated for vector types, preventing compiler crashes and ensuring correct transformation of vectorized copysign expressions.
In Details
The match.pd rules for (trunc)copysign(extend x, extend y) and related patterns have been modified to use element_precision instead of TYPE_PRECISION when evaluating guards. This resolves an ICE triggered by TYPE_PRECISION on vector types during gimple_simplify. The change aligns with the abs fix and ensures that direct_internal_fn_supported_p correctly guards vectorized operations, making the transform safe for vector types.
- match.pd
- A component within GCC's optimization framework responsible for pattern matching and applying transformations based on defined rules, often within the 'tree-optimization' or 'middle-end' phases.
- copysign
- A mathematical function that returns a value with the magnitude of the first argument and the sign of the second argument.
- element_precision
- A query that returns the precision (e.g., number of bits) of the individual elements within a vector data type.
- TYPE_PRECISION
- A GCC internal macro or function used to query the bit precision of a data type. Applying it directly to vector types can lead to errors.
- ICE
- Internal Compiler Error, a crash within the compiler itself, usually indicating a bug in the compiler's internal logic or an unexpected program construct.
- vector type
- A data type representing a collection of elements of the same underlying type, processed simultaneously by SIMD or vector instructions.