https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82641
--- Comment #3 from Yichao Yu <yyc1992 at gmail dot com> ---
> ARMv8-a is the only architecture variant where the CRC extension is optional
Not really. There's also armv8-r and armv8-m. Also, I believe code compiled for
armv7-a can run on armv8-a hardware and can also optionally enable armv8
features including CRC extension. I was hoping that GCC can be smart enough to
enable the correct armv8 variant automatically.
Test case is just
```
#include <stdint.h>
#pragma GCC push_options
#pragma GCC target("armv8-a+crc")
__attribute__((target("armv8-a+crc"))) uint32_t crc32cw(uint32_t crc, uint32_t
val)
{
uint32_t res;
/* asm(".arch armv8-a"); */
/* asm(".arch_extension crc"); */
asm("crc32cw %0, %1, %2" : "=r"(res) : "r"(crc), "r"(val));
/* asm(".arch armv7-a"); */
return res;
}
#pragma GCC pop_options
```
Compiled with either armv7-a or armv8-a march.