[Bug tree-optimization/124902] sum reduction of 2 masked_loads not vectorized

2026-04-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124902

--- Comment #2 from Drea Pinski  ---
Even this should be vectorizable:
```
unsigned int foo(
const unsigned * __restrict__ a,
const unsigned * __restrict__ b,
const unsigned * __restrict__ c,
int n
) {
unsigned sum = 0;
for (int i = 0; i

[Bug tree-optimization/124902] sum reduction of 2 masked_loads not vectorized

2026-04-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124902

Drea Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
Summary|[LoopVectorize][AArch64]|sum reduction of 2
   |GCC fails to vectorize  |masked_loads not vectorized
   |conditional reduction with  |
   |`if` statement that Clang   |
   |vectorizes with SVE |
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2026-04-16
  Component|target  |tree-optimization

--- Comment #1 from Drea Pinski  ---
Confirmed.

Simplified testcase:
```
unsigned int foo(
const unsigned * __restrict__ a,
const unsigned * __restrict__ b,
const unsigned * __restrict__ c,
int n
) {
unsigned sum = 0;
for (int i = 0; i