AMD Posts New GCC Compiler Patch For Extended Load Optimization

AMD Posts New GCC Compiler Patch For Extended Load Optimization

It's nice seeing a new GNU Compiler Collection (GCC) patch out of AMD today that is a general optimization for the x86_64 compiler code and not exclusively tied to their Zen processors. It's an Extended Load Optimization to benefit code where there is a narrower type and then an arithmetic type with a wider type. It wasn't too long ago that AMD Zen "znverX" compiler enablement work for GCC was largely done post-launch and often left to AMD's partners at SUSE. Thankfully not only has AMD begun upstreaming their new compiler Zen target support earlier (znver6 began materializing at the end of 2025) both for GCC and LLVM/Clang, but are now beginning to see them work more on general compiler optimization activities too. Sridevi on AMD's compiler team posted the newest optimization patch today for this Extended Load Optimization and explained: "When the code involves load in narrower type followed by arithmetic operation in wider type, GCC is generating code that uses vextract instructions, while it could instead make use of extended loads with ZMM registers to achieve better performance. This patch adds support to identify load + convert pattern in SLP tree and narrow the load vector type to narrower vector type if the target supports the fused load-and-extend for the case. The function vect_optimize_slp_widening_loads runs in tree-vect-loop.cc before SLP operation analysis. The implementation does not affect costing as no vectorization cost is computed using the old (wide) load type. When SLP operation costs are first recorded, they already see the narrowed load type. The implementation also may have no unintended side effects as the narrowing is applied only if load is referred only once in the SLP graph. i.e. by the convert following it and the SLP tree structure and GIMPLE IR is not modified, only an SLP analysis field is updated." This patch doesn't depend upon any Zen-specific targeting but benefits the x86_64 path when the code involves loads in a narrower type followed by arithmetic with a wider type. The patch is now under review for possible inclusion into GCC 17. No performance numbers were provided with the public patch for helping to quantify the impact of this optimization but in any case nice to see AMD investing more now in general GCC optimizations.

Original Source

Read the full article at Phoronix →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.