in reply to How best to write a cross-platform .xs module using x64 assembler?

First write a XS/C version of your module trying to keep clearly separated what is interface to Perl (the XS side) from the code implementing the algorithm (the C side).

Then add the assembler code inlined into the C function implementing the algorithm guarded by compiler macros so that the asm version is used on the platforms supporting it (i.e. x86_64) and the pure C on those that doesn't.

Another approach is to include the asm version of the function in its own .S file, but then you will have to add the rules for its compilation into the Makefile. Nowadays, most perls are compiled with gcc which can also be used to compile assembler code, so it should be a relatively easy task!

In order to detect when to use the C version or the asm version you can access the perl build configuration using Config, or in case that's not enough, you can go for Config::AutoConf.