> Cool. But it even gets better: one can use these target options on a per-
>   function basis, via __attribute__. See
>
https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/x86-Function-Attributes.html#index-target_0028_0022avx_0022_0029-function-attribute_002c-x86
>
https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/x86-Function-Attributes.html#index-target_0028_0022pclmul_0022_0029-function-attribute_002c-x86
>
>   With this, you are not forced to make the pclmul code a separate
compilation
>   unit. You can rename the .c file to a .h file and #include it from
crc.h.
>   (If you like. It's a matter of style at this point.)

> Don't need three different modules, right? A package will either want or
> not want x86_64 specific optimizations. Why would a package need to say
> "I want this optimization but not the other ones"?

I'd prefer to keep them as separate files if you're okay with it. I did a
quick experiment and by wrapping each function in push_options and
pop_options pragmas it was pretty easy to get it all working in the same
file so I can confirm that option does work. It makes sense to keep them in
the same module though, I agree. Ultimately we can delay this decision
until we have the avx2/avx512 implementations, I'll rename the module
to crc-x86_64 in the meantime though.

Reply via email to