https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128562
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2026-11-09
--- Comment #2 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
The compiler is now smart enough to spot that for normal arithmetic,
(a + b) >> 1
is an 'average' operation. This is fine in normal vectorised code because
overflow is UB.
However...
Internally the arm_neon.h header file is transforming vaddq_8 into a vector
addition. But, unlike normal C addition, the intrinsic is well-defined on
overflow, so we need to perform the arithmetic in the unsigned domain, with
casts on the inputs and the result.