GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/i386

i386: Fix double-word zero-extension cost for Skylake/Ice Lake

Corrects the cost of double-word zero-extensions on specific i386 microarchitectures to enable better optimization.

This commit adjusts the cost model for double-word zero-extensions on Skylake and Ice Lake microarchitectures. The previous cost led to suboptimal optimization choices, such as preventing Store-to-Vector (STV) conversions by causing redundant zero-extensions. By using the ‘add’ cost, which accounts for the upper word clearing, the optimizer can now make more efficient decisions.

In Details

The ix86_rtx_costs in config/i386/i386.cc are updated to reflect the actual cost of double-word zero-extensions (e.g., movzx reg, mem into a 64-bit register) on specific i386 microarchitectures. For Skylake and Ice Lake, the cost was previously underestimated, leading to issues with common subexpression elimination (CSE) and Store-to-Vector (STV) conversion. The patch assigns the 'add' cost to standalone double-word zero-extensions and a slightly higher cost to sign extensions to guide optimization decisions correctly.

For Context
zero-extension
An operation that expands a smaller integer value into a larger one by filling the upper bits with zeros. For example, zero-extending an 8-bit value to 32 bits.
double-word
Refers to a 64-bit integer value on x86 architectures.
CSE
Common Subexpression Elimination, an optimization technique that identifies and replaces identical expressions with a single temporary variable.
STV conversion
Store-to-Vector conversion, an optimization where a series of scalar stores to memory is vectorized into a single wider store operation.
Skylake
A microarchitecture generation for Intel Core processors.
Ice Lake
A microarchitecture generation for Intel Core processors, succeeding Skylake.
RTX
Representation of intermediate values in GCC, often referred to as RTL (Register Transfer Language) expressions.
Filed Under: i386optimizationcost model