SIMD memcpy assembler implementation
save the registers we intend to alter, failure to do so causes problems when gcc -O3 is used


It should be possible to avoid the pushes and pops.  If you are changing the values of the constraints, you cannot have them as just "inputs" (which is where this code currently has them).  Quoting the docs:


  Do not modify the contents of input-only operands (except for inputs tied to outputs). The compiler assumes that on exit from the asm statement these operands contain the same values as they had before executing the statement.


There are a variety of ways to deal with this.  Simply moving the ones you actually change to the "outputs" section and changing them to "+r" might be sufficient.  Note that this will indeed change the values, which might affect your "remaining bytes" code.


  [rem]"d" (rem)


Is there some reason you need this value in that specific register?  Letting the optimizers pick the registers tends to be a better plan.


  let alone the AT&amp;T syntax


If you prefer the intel format for writing asm (and what rational person doesn't?), gcc has the -masm=intel option.

And lastly, have you tried writing this in C using intrinsics?  There are a couple of places in your code where I wonder if a different arrangement of instructions might give better results, but I can't say without trying it or running an analysis tool.

It's hard for humans to optimally arrange assembler instructions for modern processors.