GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
aarch64 Performance Win

aarch64: Use SVE2 PMULLB for clmul in streaming mode

aarch64 compiler uses new SVE2 instructions for carry-less multiplication in streaming mode, improving performance.

This commit enables the use of SVE2 PMULLB instructions for carry-less multiplication (clmul) in streaming mode on aarch64. Previously, clmul operations in streaming mode were limited and fell back to less efficient multiply-based sequences. The new PMULLB instruction, available in streaming mode, provides a more direct and performant way to compute clmul, especially for 8-bit and 32-bit inputs. This change significantly reduces instruction counts for clmul operations, as demonstrated by an example that shrinks a 44-instruction sequence to just 7.

In Details

This change introduces aarch64_expand_sve_clmul to leverage SVE2's PMULLB instruction for carry-less multiplication (clmul) operations. It addresses limitations in Advanced SIMD PMULL within streaming mode. The implementation utilizes scalar patterns for 8-bit and 32-bit inputs, involving register renaming and shifts, and a pair form for 64-bit inputs. This optimizes clmuldi3, clmul_widendi3, clmul_widenqi3, and introduces clmul_widensi3, preferring Advanced SIMD PMULL when available but falling back to SVE2 PMULLB for improved performance in streaming contexts and when specific hardware feat…

For Context
SVE2
Scalable Vector Extension 2, an extension to the Arm architecture that provides advanced vector processing capabilities, including a larger set of instructions and wider vector registers.
PMULLB
A specific instruction within SVE2 that performs a carry-less multiplication, producing a result twice the width of the input operands, suitable for cryptographic and polynomial multiplication algorithms.
clmul
Carry-less multiplication, an operation used in various fields like error correction codes and cryptography, where the multiplication is performed without generating carries.
streaming mode
A mode of operation for certain vector instructions where data is processed in a continuous flow, often optimized for latency and throughput in specific scenarios.
optab
Optimization table, a data structure within the compiler that maps high-level operations to specific machine instructions or sequences of instructions.
Filed Under: aarch64optimizationSVE2crypto