https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118145
Bug ID: 118145
Summary: Regression of code generation due to an overly eager
vectorization attempt
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: arseny.kapoulkine at gmail dot com
Target Milestone: ---
For the following code snippet:
bool canEncodeZero(const unsigned char* buffer)
{
uint64_t x, y;
memcpy(&x, buffer + 0, 8);
memcpy(&y, buffer + 8, 8);
return (x | y) == 0;
}
https://gcc.godbolt.org/z/eeWKsn4Y7
gcc 13.x used to generate optimal code (mov/or/sete); however, since gcc 14.x
on -O2 and -O3 the generated code is less optimal due to extra vector
instructions that don't end up being worthwhile.
The issue persists on gcc trunk.