https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124900
Bug ID: 124900
Summary: [15/16 Regression] CRC pass increases codesize for
targets without the optab at -Os
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: code-size
Severity: normal
Priority: P3
Component: middle-end
Assignee: tnfchris at gcc dot gnu.org
Reporter: tnfchris at gcc dot gnu.org
Target Milestone: ---
#include <stdint.h>
#include <stddef.h>
uint32_t crc32(const uint8_t *data, size_t length)
{
uint8_t i;
uint32_t crc = 0xffffffff; // Initial value
while (length--) {
crc ^= (uint32_t)(*data++) << 24;
#pragma GCC unroll 0
for (i = 0; i < 8; ++i) {
if (crc & 0x80000000)
crc = (crc << 1) ^ 0x04C11DB7;
else
crc <<= 1;
}
}
return crc;
}
when compiled with -Os -march=armv8-a increases the codesize significantly
because it generates a loop that's as big as the original but adds a lookup
table of 255 bytes.