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.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.