SUNDAY, SEPTEMBER 27, 2026
vect Performance Win
Vectorizer avoids redundant widen-narrow sequence for SAT_TRUNC.
Vectorizer optimization avoids redundant widen-then-narrow operations for SAT_TRUNC.
The vectorizer now looks through promotions to avoid a redundant widen-and-narrow sequence when SAT_TRUNC is supported for narrower types. This optimization targets the tree-vect-patterns.cc file and introduces new test cases for SAT_TRUNC promotion.
In Details
The vectoreizer's pattern recognition in tree-vect-patterns.cc is enhanced to handle MAX_EXPR and SAT_TRUNC more efficiently. It now avoids redundant widen-and-narrow operations by using a single-use unpromoted input when target support exists for the narrower type, improving scalar to vector conversion for saturated truncations.
For Context
- SAT_TRUNC
- Represents a saturating truncation operation in vector code generation. It truncates a value to a narrower type and clamps it to the maximum or minimum value of that narrower type if it exceeds the representable range.
- MAX_EXPR
- Likely refers to an expression involving maximum values, potentially used in conjunction with saturation operations to define the bounds of a data type.
- widen-and-narrow sequence
- A sequence of operations where data is first widened to a larger type and then narrowed back down. This can be inefficient if not necessary and is often an artifact of intermediate compiler transformations.