GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
rs6000 Performance Win

rs6000: Use single vcmpnezb for vec_first_mismatch_or_eos_index

Optimizes vec_first_mismatch_or_eos_index intrinsic on rs6000 by using a single vcmpnezb instruction.

This commit optimizes the vec_first_mismatch_or_eos_index intrinsic on the rs6000 architecture by replacing a multi-step comparison sequence with a single vcmpnezb instruction. This eliminates redundant vector compare instructions and masking logic, resulting in more efficient and shorter generated code.

In Details

Replaces the existing sequence of vcmpneb instructions and xxland/xxlorc masking logic in the first_mismatch_or_eos_index pattern (vsx.md) with a single vcmpnezb instruction. This leverages the combined functionality of vcmpnezb to handle both end-of-stream and mismatch conditions more efficiently, reducing instruction count and improving performance for this intrinsic.

For Context
rs6000
The GCC target name for IBM POWER processors, including PowerPC architectures.
vcmpnezb
A VSX (Vector Scalar Extension) instruction that performs a vector compare for not-equal-to-zero bytes. It is used here to efficiently find the first differing element or the end of a vector.
intrinsic
A function that is recognized by the compiler and translated directly into a specific machine instruction or sequence of instructions, often providing access to hardware-specific features.
VSX
Vector Scalar Extension, an instruction set extension for PowerPC architectures that provides SIMD (Single Instruction, Multiple Data) capabilities for both floating-point and integer operations.
Filed Under: rs6000powerpcoptimizationvector