MFENCE vs. LOCK addl

John Rose John.Rose at Sun.COM
Wed Feb 25 11:57:52 PST 2009


What about XCHG?  It doesn't set flags, and (as a bonus) it implies  
the effect of a LOCK prefix:
	push rax
	xchg rax
	pop rax

-- John

On Feb 25, 2009, at 7:05 AM, Jiva, Azeem wrote:

> Paul,
>  Ahh right, I did some experiments with running MFENCE vs. LOCK ADDL
> and MFENCE vs. PUSH/LOCK ADDL/POPF and found that MFENCE is faster  
> than
> PUSH/LOCK/POP but not faster than just using the LOCK instruction by
> itself.  A nice optimization would be if the JVM could detect if the
> condition codes needed to be saved instead of saving them always.    
> This
> is on AMD hardware, and other systems might have different performance
> issues.




More information about the hotspot-compiler-dev mailing list