Q:

SSE division by integer

I am currently working on function, that calculates Taylor approximation of sin(x) function, using C & 64-bit assembly combined (C using asm function).
I am moderately new to assembly & low-level programming, and I still don't get few things.
Let's call function in C:
     float taylor(float fi, float n); 

where fi is the angle, and n is number of steps. I got it, that in assembly part fi is stored in xmm0 register, and n is stored in rax register.

In which register should I put return value at the end? (as float)
I calculate x^3, x^5, x^7 etc. by simply multiplying xmm register holding value by itself, but how to divide it by integer factorial? (x^3/3! and so on). Is there any way to put f.e. 3! = 6 into xmm register making it float, so it will be seen as 6.0? I have no idea how to divide these two numbers. I tried something like that:
movq $6, %rbx
movq %rbx, %xmm1
divpd %xmm0, %xmm1

But it gives result of NaN (given example parameters: 6 10) - and I have no idea how to make it work...

A:

You should take some time to study the instruction set reference, so you at least get a rough idea what kind of possibilities you have. Also, you should read the appropriate ABI docs for the calling convention.
That said, the answer to your first question is float return values should be passed back in xmm0 and you can convert from integer to float using CVTSI2SS (or CVTSI2SD for double precision).
Also note you should be using the proper scalar/packed and float/double versions. divpd is packed double, while you need scalar single, so you really want divss.
PS: your question is specifically not about FPU or MMX. Rather, it is about SSE.

