I know that in 32-bit assembly, one can compute a power (the equivalent of pow(double, double)
in C) using a combination of the x87 instructions FYL2X
, F2XM1
and FSCALE
.
In 64-bit assembly, however, I read that the use of the x87 math coprocessor is deprecated and that the SSE2 instructions should be used instead. While I was able to find instructions like ADDSD
, MULSD
and DIVSD
that operate on XMM registers, I was not able to find anything related to powers, exponentials or logarithms (the only close one I found was SQRTSD
but it doesn't help too much) that could help me compute powers.
So how can powers (a^b where both a and b are floating-point) be computed using SSE2 instructions? Can it even be done or do you need to resort to software computation or the x87?