https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101639
Bug ID: 101639
Summary: vectorization with bool reduction
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
Target Milestone: ---
Target: x86_64-*-*
bool f(char* p, long n)
{
bool r = true;
for(long i = 0; i < n; ++i)
r &= (p[i] != 0);
return r;
}
is not vectorized, while if I simply declare r as char instead of bool, it is
(not quite optimal since it fails to pull &1 out of the loop, but that's a
separate issue).