Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

x87 and out-of-order execution

k_sarnath
Beginner
172 Views
Since most x87 instructions rely on TOP OF STACK as an implied parameter -- Will it affect out of order execution?
Will switching to scalar SSE code give dramatic performance (like doing a MUL and ADD together etc..)

Thanks,
0 Kudos
1 Solution
capens__nicolas
New Contributor I
172 Views
It affects out-of-order execution in the same way as other operand dependencies. Also note that the XCHG instruction is virtually for free (latency 0) since it is handled as a register renaming.

However, x87 by default computes 80-bit results, which for operations like division and square root are very slow. You can explicitly lower that precision to 64- or 32-bit though through the control word.

Also, some compilers are not that good at creating efficient x87 code due to the complications ofmanaging theregister stack. There can generate notably faster scalar SSE code. As far as I'm aware the difference on most reputable compilers is very minor though.

Furthermore on x64 SSE has access to 16 registers which for some algorithms reduces spilling.

But if you really want to improve performance you should probably look into parallelising your code to make full use of SSE (and later AVX).

View solution in original post

2 Replies
capens__nicolas
New Contributor I
173 Views
It affects out-of-order execution in the same way as other operand dependencies. Also note that the XCHG instruction is virtually for free (latency 0) since it is handled as a register renaming.

However, x87 by default computes 80-bit results, which for operations like division and square root are very slow. You can explicitly lower that precision to 64- or 32-bit though through the control word.

Also, some compilers are not that good at creating efficient x87 code due to the complications ofmanaging theregister stack. There can generate notably faster scalar SSE code. As far as I'm aware the difference on most reputable compilers is very minor though.

Furthermore on x64 SSE has access to 16 registers which for some algorithms reduces spilling.

But if you really want to improve performance you should probably look into parallelising your code to make full use of SSE (and later AVX).
k_sarnath
Beginner
172 Views
Thanks for the detailed answer! It was useful.
Reply