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

aarch64: Fix big-endian lane order for ADDP instruction

Corrects the lane ordering for the ADDP SIMD instruction on big-endian AArch64 targets.

This commit fixes an issue with the Arm ADDP SIMD instruction on big-endian systems where the lane order was incorrect. The problem stemmed from the use of GCC’s lane numbering, which differs from the architectural numbering on big-endian targets. The fix involves swapping input operands for the ADDP instruction patterns on big-endian targets and adjusting the expander to match the correct lane ordering, ensuring correct results for vectorized operations.

In Details

On big-endian AArch64 targets, GCC's internal lane numbering for SIMD operations reverses the architectural lane numbering. This commit corrects the aarch64_addp instruction patterns in the machine description file to account for this discrepancy. Specifically, it swaps input operands for ADDP variants on big-endian systems and re-introduces operand swapping in the vpadd expander, resolving incorrect results observed in specific test cases and ensuring consistent behavior across endiannesses.

For Context
ADDP
An Advanced SIMD (Single Instruction, Multiple Data) instruction on ARM architectures that performs pairwise addition of elements within vectors.
SIMD
Single Instruction, Multiple Data. A class of parallel computers in Flynn's taxonomy that perform the same operation on multiple data points simultaneously.
big-endian
A computer architecture's byte order where the most significant byte is stored at the lowest memory address.
lane numbering
The indexing scheme used to refer to individual elements (lanes) within a SIMD vector register. The numbering can differ between the architecture's specification and the compiler's internal representation.
RTL
Register Transfer Language, an intermediate representation used within GCC to represent program transformations.
Filed Under: aarch64simdendiannessbugfix