I know that x87 has higher internal precision, which is probably the biggest difference that people see between it and SSE operations. But I have to wonder, is there any other benefit to using x87? I have a habit of typing -mfpmath=sse
automatically in any project, and I wonder if I'm missing anything else that the x87 FPU offers.
views:
593answers:
4There is considerable legacy and small system compatibility with the x87: SSE is a relatively new processor feature. If your code is to run on an embedded microcontroller, there's a good chance it won't support SSE instructions.
Even systems which don't have an FPU installed will often provide 80x87 emulators which will make the code run transparently (more or less). I don't know of any SSE emulators—certainly one of my systems doesn't have any, so the newest Adobe Photoshop elements versions refuse to run.
The 80x87 instructions have good parallel operation characteristics which have been thoroughly explored and analyzed since its introduction in 1982 or so. Various clones of the x86 might stall on an SSE instructions.
x87 has some instructions that don't exist in the SSE instruction set.
Out of the head it's all the trigonometric stuff like fsin, fcos, fatan, fatan2 and some of the exponential/logarithm stuff.
If your code spends most of the time doing trigonometry you may see a slight performance boost if you use x87. Some DSP algorithms would fall into this category.
However, for code math-code where you spend most of your time doing additions, multiplications ect. SSE is usually faster.
FPU instructions are smaller than SSE instructions, so they are ideal for demoscene stuff