Almost identical lines of codes are repeated for each pair counter in the function dispatch setup. All of these lines with the exception of the definition of allfunctions could be wrapped up in a macro.
Even better would be a macro that accepts 6 arguments, the first argument being the type of the function pointer (i.e., type of allfunctions) and each of the remaining arguments corresponding to the name of the avx512f, avx2, avx, sse42 and fallback kernels. The macro would then produce the appropriate code, with checking for compile time support (or lack there-of) for the various features.
Almost identical lines of codes are repeated for each pair counter in the function dispatch setup. All of these lines with the exception of the definition of
allfunctions
could be wrapped up in a macro.Even better would be a macro that accepts 6 arguments, the first argument being the type of the function pointer (i.e., type of
allfunctions
) and each of the remaining arguments corresponding to the name of theavx512f
,avx2
,avx
,sse42
andfallback
kernels. The macro would then produce the appropriate code, with checking for compile time support (or lack there-of) for the various features.