Skip to contentSkip to conversation

tcg/x86_64: generated dec/inc instead of sub/addwhen possible

Qemu-devel Avi Kivity 3 participants 5 messages Sep 28, 2009 – Sep 29, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Avi Kivity

author
#1 lore raw
Quoted 2 lines · Anthony Liguori

From: Aurelien Jarno<[email protected]>

Intel recommends not using inc/dec. Since these instructions don't update all of the flags, they cannot be issued in parallel to previous instructions that do.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#2 lore raw
Quoted 8 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori

From: Aurelien Jarno<[email protected]>

Intel recommends not using inc/dec.  Since these instructions don't update all of the flags, they cannot be issued in parallel to previous instructions that do.

That's true, but I think Icache misses will cost you more than the false dependencies; due to code size expansion in the translation process, optimizing rules should not be obeyed blindly. I guess this should be measured.

Laurent

#3 lore raw
Quoted 6 lines · Laurent Desnogues
Quoted 5 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori

From: Aurelien Jarno<[email protected]>

Quoted 8 lines
Quoted 3 lines

Intel recommends not using inc/dec.  Since these instructions don't update all of the flags, they cannot be issued in parallel to previous instructions that do.

That's true, but I think Icache misses will cost you more than the false dependencies;  due to code size expansion in the translation process, optimizing rules should not be obeyed blindly.  I guess this should be measured.

I vaguely remember measuring it and the results were different on Pentium IV-based and Pentium M-based processors. On one of them inc/dec was faster, while on the other it was add/sub. I can't remember which one had which results though.

Best regards,
Filip Navara

#4 lore raw
Quoted 5 lines · Filip Navara

I vaguely remember measuring it and the results were different on Pentium IV-based and Pentium M-based processors. On one of them inc/dec was faster, while on the other it was add/sub. I can't remember which one had which results though.

Do you mean in a QEMU context or something else? If that was with QEMU, was the program significantly large?

Laurent

#5 lore raw
Quoted 9 lines · Laurent Desnogues
Quoted 5 lines · Filip Navara

I vaguely remember measuring it and the results were different on Pentium IV-based and Pentium M-based processors. On one of them inc/dec was faster, while on the other it was add/sub. I can't remember which one had which results though.

Do you mean in a QEMU context or something else?  If that was with QEMU, was the program significantly large?

In QEMU/TCG context. It was some synthetic benchmark, most probably Dhrystone.

Best regards,
Filip Navara